Problem:


Score: 300 points

Problem Statement

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.  

Constraints

N is an integer between 1 and 100 (inclusive).

x_i and y_i are integers between 0 and 100 (inclusive).

h_i is an integer between 0 and 10^9 (inclusive).

The N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.

The center coordinates and the height of the pyramid can be uniquely identified.

Input

Input is given from Standard Input in the following format:  

N
x_1 y_1 h_1
x_2 y_2 h_2
x_3 y_3 h_3
:
x_N y_N h_N

Output

Print values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.  

Sample Input 1

4
2 3 5
2 1 5
1 2 5
3 2 5

Sample Output 1

2 2 6

In this case, the center coordinates and the height can be identified as (2, 2) and 6.  

Sample Input 2

2
0 0 100
1 1 98

Sample Output 2

0 0 100

In this case, the center coordinates and the height can be identified as (0, 0) and 100.

Note that C_X and C_Y are known to be integers between 0 and 100.

Sample Input 3

3
99 1 191
100 1 192
99 0 192

Sample Output 3

100 0 193

In this case, the center coordinates and the height can be identified as (100, 0) and 193.  



Sample input:
4
2 3 5
2 1 5
1 2 5
3 2 5


Sample output:
2 2 6

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * (100 + 1) for _ in range(100 + 1)]
    for info in infos:
        field[info[1]][info[0]] = True
    
    for y in range(100 + 1):
        for x in range(100 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * (100 + 1) for _ in range(100 + 1)]
    for info in infos:
        field[info[1]][info[0]] = True
    
    for y in range(100 + 1):
        for x in range(100 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(1 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * (1 + 1) for _ in range(1 + 1)]
    for info in infos:
        field[info[1]][info[0]] = True
    
    for y in range(1 + 1):
        for x in range(1 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(1 + 1):
    for cx in range(1 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * 101 for _ in range(101)]
    for info in infos:
        field[info[0]][info[1]] = True
    
    for y in range(100 + 1):
        for x in range(100 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]
 
for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]

        flag_assumpt = True
        for info in infos[1:]:
            pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]

            if pseudo_h1 != pseudo_h2:
                flag_assumpt = False
                break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
print(x,y,H)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        if flag:
            break
        for i in range(N):
            if i==0:
                H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
            if a[i][2]!=0 and H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]) and H>=abs(cx-a[i][0])+abs(cy-a[i][1]):
                break
            if i==N-1:
                x=cx
                y=cy
                flag=True
print(x,y,H)

Submission status: Wrong Answer

Solution code:
n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    xyh.append(a)

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(n):
            if xyh[i][2]==0:
                if l>abs(x-xyh[i][0])+abs(y-xyh[i][1]):
                    p=1
                    break
                else:
                    continue
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    if a[2]!=0:
        xyh.append(a)
    else:
        if n==2:
            xyh.append(a)
for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(len(xyh)):
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    if a[2]!=0:
        xyh.append(a)

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(len(xyh)):
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
xyh=[]
for i in range(n):
    xyh.append([int(j) for j in input().split()])

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(n):
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()

Submission status: Wrong Answer

Solution code:
def find_h(x, y, P):
	h = None
	for p in P:
		cx, cy, ch = p
		if ch == 0:
			continue
		calc_h = ch + abs(x - cx) + abs(y - cy)
		if h is None:
			h = calc_h
		elif h != calc_h:
			return None		
	return h


N = int(input())
P = []
for _ in range(N):
	P.append(tuple(int(v) for v in input().split()))
h = None
for x in range(101):
	for y in range(101):
		h = find_h(x, y, P)
		if h is not None:
			print(x, y, h)
			break
	if h is not None:
		break

Submission status: Wrong Answer

Solution code:
def find_h(x, y, P):
	h = None
	for p in P:
		cx, cy, ch = p
		if ch == 0:
			continue
		calc_h = ch + abs(x - cx) + abs(y - cy)
		if h is None:
			h = calc_h
		elif h != calc_h:
			return None		
	return h


N = int(input())
P = []
for _ in range(N):
	P.append(tuple(int(v) for v in input().split()))
h = None
for x in range(101):
	for y in range(101):
		h = find_h(x, y, P)
		if h is not None:
			print(x, y, h)
	if h is not None:
		break

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]
for cx in range(101):
    for cy in range(101):
        H=[A[i][2]+abs(A[i][0]-cx)+abs(A[i][1]-cy) for i in range(N) if A[i][2]!=0]#N地点の(高さ０以外)h-|x-cx|-|y-cy|がconstかをしらべる
        if H.count(H[0])==len(H):
            print(str(cx)+' '+str(cy)+' '+ str(H[0]))
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = sorted([list(map(int,input().split())) for _ in range(N)], reverse = True)
mx, my, mh = xyh[0]
for Cx in range(101):
  for Cy in range(101):
    H = mh+abs(mx-Cx)+abs(my-Cy)
    if(all(h == max(0, H-abs(x-Cx)-abs(y-Cy)) for x,y,h in xyh)):
      print(Cx,Cy,H)
      exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    candi = 0
    for i in range(N):
        if h[i] == 0:
            continue
        else:
            candi = i
    for i in range(101):
        for j in range(101):
            flag = 1
            candh = h[candi] + abs(x[candi]-i) + abs(y[candi]-j)
            # print(i, j, candh)
            for xx, yy, hh in zip(x, y, h):
                # print(hh, max(candh-abs(xx-i)-abs(yy-j), 0))
                if hh != max(candh-abs(xx-i)-abs(yy-j), 0):
                    flag = 0
                    break
            if flag == 1:
                # print("!!")
                break
        if flag == 1:
            break
    trueh = h[0] + abs(x[0]-i) + abs(y[0]-j)
    print(i, j, trueh)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    h = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    flag = 1
    for i in range(101):
        for j in range(101):
            flag = 1
            candh = h[0] + abs(x[0]-i) + abs(y[0]-j)
            # print(i, j, candh)
            for xx, yy, hh in zip(x, y, h):
                # print(hh, max(candh-abs(xx-i)-abs(yy-j), 0))
                if hh != max(candh-abs(xx-i)-abs(yy-j), 0):
                    flag = 0
                    break
            if flag == 1:
                # print("!!")
                break
        if flag == 1:
            break
    trueh = h[0] + abs(x[0]-i) + abs(y[0]-j)
    print(i, j, trueh)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    h = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    if h!=0:
        l.append([x,y,h])
l2=[]
s=l[0]
for x in range(100):
    for y in range(100):
        l2.append([h+abs(x-s[1])+abs(y-s[2]),x,y])
for i in range(len(l2)):
    h,x,y=l2[i][0],l2[i][1],l2[i][2]
    for t in l[1:]:
        if t[2]==h-abs(x-t[0])-abs(y-t[1]):
            print(1)
            continue
        else:
            l2[i]=0
            break
print(list(i for i in l2 if i!=0))

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
#h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h < 1 :
            h = int(abs(x - lst1[0]  ) + abs( y - lst1[1] ) + lst1[2])
        if h != int(abs(x - lst1[0] ) + abs( y - lst1[1] ) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , int(abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2]) )

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
#h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h == 0 :
            h = abs(x - lst1[0]  ) + abs( y - lst1[1] ) + lst1[2]
        if h != (abs(x - lst1[0] ) + abs( y - lst1[1] ) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h == 0 :
            h = abs(x - lst1[0]  ) + abs( y - lst1[1] ) + lst1[2]
        if h != (abs(x - lst1[0] ) + abs( y - lst1[1] ) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h == 0 :
            h = abs(x - lst1[0]  ) + abs( y - lst1[1] ) + lst1[2]
        elif h != max(0,(abs(x - lst1[0] ) + abs( y - lst1[1] ) + lst1[2])) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h == 0 :
            h = abs(x - lst1[0]  ) + abs( y - lst1[1] ) + lst1[2]
        elif h != (abs(x - lst1[0] ) + abs( y - lst1[1] ) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = 0
def check(x , y):
    h = 0
    for lst1 in lst:
        if h == 0 :
            h = abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]
        elif h != (abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = -1
def check(x , y):
    h = -1
    for lst1 in lst:
        if h == -1 :
            h = abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]
        elif h != (abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]) :
            return False
    return True
  
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = -1
def check(x , y):
    h = -1
    for lst1 in lst:
        if h == -1 :
            h = abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]
        elif h != (abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]) :
            return False
    return True

if N == 1:
    print(lst[0][0],lst[0][1],lst[0][2])
    exit()
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = -1
def check(x , y):
    h = -1
    for lst1 in lst:
        if h == -1 :
            h = abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]
        elif h != (abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]) :
            return False
    return True

if N == 1:
    print(lst[0][0],lst[0][1],lst[0][2])
    exit()
for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())
# 中心座標の絞り込みに使用
# 全
# 各座標、高さをリストに格納
lst =  [[int(j) for j in input().split()] for _ in range(N)]
h = -1
def check(x , y):
    h = -1
    for lst1 in lst:
        if h == -1 :
            h = abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]
        elif h != (abs(lst1[0] - x ) + abs(lst1[1] - y) + lst1[2]) :
            return False
    return True

for i in range(101):
    for j in range(101):
        if check(i,j):
            print(i , j , abs(lst[0][0] - i) + abs(lst[0][1] - j) + lst[0][2])

Submission status: Wrong Answer

Solution code:
N = int(input())

SIZE = 101

data = []
for i in range(N):
    d = list(map(int, input().split()))
    data.append(d)

def available_heights(d, x, y):
    v = max(d[2] + abs(x - d[0]) + abs(y - d[1]), 0)
    return v

a_map = []
for x in range(SIZE):
    a = []
    for y in range(SIZE):
        a.append(available_heights(data[0], x, y))
    a_map.append(a)

remain_data = data[1:]
for d in remain_data:
    for x in range(SIZE):
        for y in range(SIZE):
            if a_map[x][y] == None:
                continue
            h = available_heights(d, x, y)
            if a_map[x][y] != h:
                a_map[x][y] = None
for x in range(SIZE):
    for y in range(SIZE):
        if a_map[x][y] != None:
            print(str(x) + " " + str(y) + " " + str(a_map[x][y]))
            x = SIZE
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
xs, ys, hs = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    xs.append(x)
    ys.append(y)
    hs.append(h)

for cx in range(0, 101):
    for cy in range(0, 101):
        is_center = True
        for i in range(N):
            x, y, h = xs[i], ys[i], hs[i]
            if i == 0:
                ch = h + abs(x-cx) + abs(y-cy)
            else:
                if h + abs(x-cx) + abs(y-cy) != ch:
                    is_center = False
                    break
        else:
            print(cx, cy, ch)

Submission status: Wrong Answer

Solution code:
N = int(input())
xs, ys, hs = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    xs.append(x)
    ys.append(y)
    hs.append(h)

for cx in range(0, 101):
    for cy in range(0, 101):
        is_center = True
        for i in range(N):
            x, y, h = xs[i], ys[i], hs[i]
            if i == 0:
                ch = h + abs(x-cx) + abs(y-cy)
            else:
                if h + abs(x-cx) + abs(y-cy) != ch:
                    is_center = False
        if is_center:
            print(cx, cy, ch)
            exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
x = []
y = []
h = []
for i in range(n):
    x1,y1,h1=[int(i) for i in input().split()]
    x.append(x1) 
    y.append(y1) 
    h.append(h1)

flag = 0
a,b,c = 0,0,0
for i in range(101):
    if flag:
        break
    else:
        for j in range(101):
            if flag:
                break
            else:
                for k in range(n):
                    if h[k] != 0:
                        first = abs(x[0]-i)+abs(y[0]-j)+h[0]
                        break
                ct = 0
                for k in range(n): 
                    tmp = abs(x[k]-i)+abs(y[k]-j)+h[k]
                    if first == tmp or (first < tmp and h[k]==0):
                        ct += 1
                    if ct == n:
                        a,b,c = i,j,first
                        flag = 1

print("{} {} {}".format(a,b,c))

Submission status: Wrong Answer

Solution code:
n = int(input())
x = []
y = []
h = []
for i in range(n):
    x1,y1,h1=[int(i) for i in input().split()]
    x.append(x1) #x += [x1]
    y.append(y1) #y += [y1]
    h.append(h1)

flag = 0
a,b,c = 0,0,0
for i in range(101):
    if flag:
        break
    else:
        for j in range(101):
            if flag:
                break
            else:
                first = abs(x[0]-i)+abs(y[0]-j)+h[0]
                ct = 0
                for k in range(n): 
                    tmp = abs(x[k]-i)+abs(y[k]-j)+h[k]
                    if first == tmp:
                        ct += 1
                    if ct == n:
                        a,b,c = i,j,first
                        flag = 1

print("{} {} {}".format(a,b,c))

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,0],[3,2,5]])
for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    correctflg = True
    unsetflg = True
    for i,(x,y,h) in enumerate(data):
        if unsetflg:
            if h >= 1:
                H = abs(x-C_x)+abs(y-C_y)+h
                unsetflg = False
        else:
            if h >= 1 and H != abs(x-C_x)+abs(y-C_y)+h:
                correctflg = False
                break 
    if correctflg:
        print(C_x,C_y,int(H))
        break

Submission status: Wrong Answer

Solution code:
def ans():
  N = int(input())
  xyh = [list(map(int,input().split())) for _ in range(N)]
  mx, my, mh = xyh[0]
  for Cx in range(101):
    for Cy in range(101):
      H = mh+abs(mx-Cx)+abs(my-Cy)
      if(all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x,y,h in xyh)):
        print(Cx, Cy, H)
        exit()
ans()

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

N = I()
xyh = []
for i in range(N):
    x, y, h = LI()
    xyh.append([x,y,h])


for i in range(100+1):
    for j in range(100+1):
        cx, cy = i, j
        H = []
        for item in xyh:
            #  print(item)
            if item[2] == 0:
                continue

            new_H = max(item[2] + abs(item[0] - cx) + abs(item[1] - cy), 0)
            H.append(new_H)
        else:
            if len(set(H)) == 1:
                center_H = H[0]
                H = []
                for item in xyh:
                    if item[2] == 0:
                        # 0の場合にも正しいか判定する
                        # 中央の高さ
                        if center_H - abs(item[0] - cx) + abs(item[1] - cy) > 0:
                        #  if ch < center_H:
                            break
                else:
                    print(i, j, center_H)
                    exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,0],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    unsetflg = True
    for i,(x,y,h) in enumerate(data):
        if unsetflg and h>=1:
            H = abs(x-C_x)+abs(y-C_y)+h
            unsetflg = False
        elif h>=1:
            if H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())

    xn = []
    yn = []
    hn = []

    for i in range(N):
        xi, yi, hi = map(int, input().split())
        xn.append(xi)
        yn.append(yi)
        hn.append(hi)

    if N == 1:
        print(xn[0], yn[0], hn[0])
        return

    for Cx in range(101):
        for Cy in range(101):

            last = None

            for i in range(N):
                if 0 == hn[i]:
                    continue

                H = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]

                if H < 0:
                    continue
                if last:
                    if (last != H):
                        break

                last = H
            else:
                print(Cx, Cy, H)
                return


main()

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,5],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    unsetflg = True
    for i,(x,y,h) in enumerate(data):
        if unsetflg and h>0:
            H = abs(x-C_x)+abs(y-C_y)+h
            unsetflg = False
        elif i > 0 and h>0:
            if H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,5],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    for i,(x,y,h) in enumerate(data):
        if i == 0:
            H = abs(x-C_x)+abs(y-C_y)+h
            if H == 0:
                break 
        elif i > 0 :
            if H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())

# data = np.array([[2,3,5],[2,1,5],[1,2,5],[3,2,5]])

for n in range(10201):
    C_x = n // 101
    C_y = n % 101
    flg = True
    for i,(x,y,h) in enumerate(data):
        if i == 0:
            H = abs(x-C_x)+abs(y-C_y)+h
        elif i > 0 :
            if H != abs(x-C_x)+abs(y-C_y)+h:
                flg = False
                break 
    if flg:
        print(C_x,C_y,int(H))
        break