Problem: In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.   The pyramid had _center coordinates_ (C_X, C_Y) and _height_ H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).  Aoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:    * C_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.    * Additionally, he obtained N pieces of information. The i-th of them is: "the altitude of point (x_i, y_i) is h_i."   This was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.

Submission attempts (in order):
N = int(input())

x_list=[]
y_list=[]
h_list=[]
h_now_list=[]

def all_same(items):
	return all(map(lambda x: x == items[0], items))

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)
		
for cy in range(101):
	for cx in range(101):
		n = -1	
		for h in h_list:
			n += 1
			if h >= 1:
				H = abs(cx - x_list[n])+abs(cy - y_list[n])+h
				break
		for i in range(N):
			h_now = max(H-abs(cx - x_list[i])-abs(cy - y_list[i]), 0)
			h_now_list.append(h_now)
			if h_now != h_list[i]:
				break	
		if len(h_now_list) == N:
			print(str(cx)+' '+str(cy)+' '+str(H))
			break		
	else:
		continue
	break

N = int(input())

x_list=[]
y_list=[]
h_list=[]

def all_same(items):
	return all(map(lambda x: x == items[0], items))

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)
		
for cy in range(101):
	for cx in range(101):
		i = -1	
		for h in h_list:
			i += 1
			if h >= 1:
				H = abs(cx - x_list[i])+abs(cy - y_list[i])+h
				break
		for i in range(N):
			h = max(H-abs(cx - x_list[i])-abs(cy - y_list[i]), 0)
			H_list.append(h) 
		if all_same(H_list):
			print(str(cx)+' '+str(cy)+' '+str(H))
			break		
	else:
		continue
	break

N = int(input())

x_list=[]
y_list=[]
h_list=[]

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)

i = -1	
for h in h_list:
	i += 1
	if h >= 1:
		H = abs(cx - x_list[i])+abs(cy - y_list[i])+h
		break
		
for cy in range(101):
	for cx in range(101):
		for i in range(N):
			h = max(H-abs(cx - x_list[i])-abs(cy - y_list[i]), 0)
			H_list.append(h) 
			if h != H:
				break 
		if len(H_list) == N:
			print(str(cx)+' '+str(cy)+' '+str(H_list[0]))
			break		
	else:
		continue
	break

N = int(input())

x_list=[]
y_list=[]
h_list=[]


def all_same(items):
	return all(map(lambda x: x == items[0], items))

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)
		
for cy in range(101):
	for cx in range(101):
		n = -1	
		for h in h_list:
			n += 1
			if h >= 1:
				H = abs(cx - x_list[n])+abs(cy - y_list[n])+h
				h_now_list=[]
				break
		for i in range(N):
			h_now = max((H-abs(cx - x_list[i])-abs(cy - y_list[i])), 0)
			h_now_list.append(h_now)
			if h_now != h_list[i]:
				break	
			else:
				if len(h_now_list)==N:
					print(str(cx)+' '+str(cy)+' '+str(H))
					break
	else:
		continue
	break

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted