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:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(3)] for i in range(3)]
    # print(a)
    for i in range(3):
        for j in range(3):
            for p in range(n):
                if c[p][2] != 0:
                    a[i][j] = abs(i - c[p][0]) + abs(j - c[p][1]) + c[p][2]
                    break


            for p in range(n):
                if c[p][2] != 0:
                    h = abs(i - c[p][0]) + abs(j - c[p][1]) + c[p][2]
                    if a[i][j] != h:
                        a[i][j] = -1
                        break
                if c[p][2] == 0:
                    h = abs(i - c[p][0]) + abs(j - c[p][1])
                    if a[i][j] > h:
                        a[i][j] = -1
                        break


    for i in range(3):
        for j in range(3):
            flag = True
            if a[i][j] == -1:continue
            # for p in range(n):
            #     h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
            #     if h != a[i][j]:
            #         flag = False
            #         break
            # if flag:
            for p in range(n):
                h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                if h!= c[p][2]:
                    flag = False
                    break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            for p in range(n):
                if c[p][2] != 0:
                    a[i][j] = abs(i - c[p][0]) + abs(j - c[p][1]) + c[p][2]
                    break


            for p in range(n):
                if c[p][2] != 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
                    if a[i][j] != h:
                        a[i][j] = -1
                        break
                if c[p][2] == 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1])
                    if a[i][j] > h:
                        a[i][j] = -1
                        break


    for i in range(101):
        flag = True
        for j in range(101):
            flag = True
            if a[i][j] == -1:continue
            # for p in range(n):
            #     h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
            #     if h != a[i][j]:
            #         flag = False
            #         break
            # if flag:
            for p in range(n):
                h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                if h!= c[p][2]:
                    flag = False
                    break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            for p in range(n):
                if c[p][2] != 0:
                    a[i][j] = abs(i - c[p][0]) + abs(j - c[p][1]) + c[p][2]
                    break


            for p in range(n):
                if c[p][2] != 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
                    if a[i][j] != h:
                        a[i][j] = -1
                        break
                if c[p][2] == 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1])
                    if a[i][j] > h:
                        a[i][j] = -1
                        break


    for i in range(101):
        flag = True
        for j in range(101):
            flag = True
            if a[i][j] == -1:continue
            for p in range(n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            for p in range(n):
                if c[p][2] != 0:
                    a[i][j] = abs(i - c[p][0]) + abs(j - c[p][1]) + c[p][2]
                    break


            for p in range(1, n):
                if c[p][2] != 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
                    if a[i][j] != h:
                        a[i][j] = -1
                        break
                if c[p][2] == 0:
                    h = abs(i - c[0][0]) + abs(j - c[0][1])
                    if a[i][j] > h:
                        a[i][j] = -1
                        break


    for i in range(101):
        flag = True
        for j in range(101):
            flag = True
            if a[i][j] == -1:continue
            for p in range(n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            if c[0][2] != 0:
                a[i][j] = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
    for i in range(101):
        flag = True
        for j in range(101):
            flag = True
            for p in range(1,n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            a[i][j] = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
    for i in range(101):
        flag = True
        for j in range(101):
            flag = True
            for p in range(1,n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            a[i][j] = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
    for i in range(101):
        if i!=100: continue

        flag = True
        for j in range(101):
            if j!=0: continue
            flag = True
            for p in range(1,n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    n = int(input())
    c = [[int(i) for i in input().split()] for i in range(n)]
    # print(c)
    a = [[0 for i in range(101)] for i in range(101)]
    # print(a)
    for i in range(101):
        for j in range(101):
            a[i][j] = abs(i - c[0][0]) + abs(j - c[0][1]) + c[0][2]
    print(a)
    for i in range(101):
        if i!=100: continue

        flag = True
        for j in range(101):
            if j!=0: continue
            flag = True
            for p in range(1,n):
                h = abs(i-c[p][0])+ abs(j-c[p][1]) + c[p][2]
                if h != a[i][j]:
                    flag = False
                    break
            if flag:
                for p in range(n):
                    h = max(a[i][j] - abs(i-c[p][0])- abs(j-c[p][1]),0)
                    if h!= c[p][2]:
                        flag = False
                        break
            if flag:
                print(i,j,a[i][j])
                quit()

Submission status: Wrong Answer

Solution code:
n=int(input())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)

use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break

print(lists)
print(use)


for i in range(0,101):
    for j in range(0,101):
        height=use[2]+abs(i-use[0])+abs(j-use[1])   
        cnt=0
        ok=True
        for inn in lists:
            if inn[2]==0:
                if height>abs(i-use[0])+abs(j-use[1]):
                    ok=False

            if inn[2]>0:
                if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                    ok=False

        if ok:
            ans=[i,j,height]
            print(*ans)
            break

Submission status: Wrong Answer

Solution code:
n=int(input())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)

use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break

        


for i in range(0,101):
    for j in range(0,101):
        height=use[2]+abs(i-use[0])+abs(j-use[1])     
        cnt=0
        for inn in lists:
            if inn[2]==0:
                if height>abs(i-use[0])+abs(j-use[1]):
                    continue
                else:
                    cnt+=1
            elif inn[2]>0:
                if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                    continue
                else:
                    cnt+=1
        if cnt==n:
            ans=[i,j,height]
            print(*ans)
            break

Submission status: Wrong Answer

Solution code:
n=int(input())
lists=[]
for i in range(n):
    tup=tuple(map(int,input().split()))
    lists.append(tup)
print(lists)
use=()
for some in lists:
    if some[2]==0:
        continue
    else:
        use=some
        break
        
        
ok=True
while ok:
    for i in range(0,101):
        for j in range(0,101):
            height=use[2]+abs(i-use[0])+abs(j-use[1])
            cnt=0
            for inn in lists:
                
                if inn[2]==0:
                    if height>abs(i-use[0])+abs(j-use[1]):
                        continue
                    else:
                        cnt+=1
                elif inn[2]>0:
                    if inn[2]+abs(i-inn[0])+abs(j-inn[1])!=height:
                        continue
                    else:
                        cnt+=1
            if cnt==n:
                ok=False
ans=[i,j,height]
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(max( (h + abs(x-X) + abs(y-Y)), 0))
    if all([i == this_sum[0] for i in this_sum]):
        H0 = max( (h + abs(x-X) + abs(y-Y)), 0)
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(max( (h + abs(x-X) + abs(y-Y)), 0))
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        if h >0:
            this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []

    for x,y,h in a:
        if h >0:
            this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i == this_sum[0] for i in this_sum]) and this_sum[0] > 0:
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    
    for x,y,h in a:
        this_sum.append(h + abs(x-X) + abs(y-Y))
        
    if all([i == this_sum[0] for i in this_sum]) and this_sum[0] > 0:
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i == this_sum[0] for i in this_sum]) and this_sum[0] > 0:
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        print(" ".join(list(map(str, [X, Y, H0]))))
        break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i == this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        break
    else:
        continue
    break

print(" ".join(list(map(str, [X, Y, H0]))))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
H =[]
for i in range(0,101):
    for j in range(0, 101):
        H.append([i,j,0])

for X,Y,H0 in H:
    this_sum = []
    for x,y,h in a:
        this_sum.append(h + abs(x-X) + abs(y-Y))
    if all([i ==this_sum[0] for i in this_sum]):
        H0 = this_sum[0]
        break

print(" ".join(list(map(str, [X, Y, H0]))))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

#初期化
N = int(input())
L = []
for i in range(N):
	x, y, h = getlist()
	L.append([x, y, h])

#探索
for i in range(101):
	for j in range(101):
		D = defaultdict(int)
		for k in range(N):
			if L[k][2] != 0:
				val = abs(L[k][0] - i) + abs(L[k][1] - j) + L[k][2]
				D[val] += 1
		if len(D) == 1 and val > 0:
			print(i, j, val)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

#初期化
N = int(input())
L = []
for i in range(N):
	x, y, h = getlist()
	L.append([x, y, h])

#探索
for i in range(101):
	for j in range(101):
		D = defaultdict(int)
		for k in range(N):
			if L[k][2] != 0:
				val = abs(L[k][0] - i) + abs(L[k][1] - j) + L[k][2]
				D[val] += 1
		if len(D) == 1:
			print(i, j, val)

Submission status: Wrong Answer

Solution code:
N = int(input())
XYH = []
for i in range(N):
  XYH.append(list(map(int,input().split())))
XYH.sort(key=lambda x: x[2], reverse=True)
#print(XYH)

# 与えられた情報のhiがすべて0ということはありえない。
# cx,cyを全探索し、与えられた情報がすべて矛盾がない場合を答えとして出力する。
x0,y0,h0 = XYH[0]
for cx in range(101):
  for cy in range(101):
    ch = h0 + abs(x0-cx) + abs(y0-cy)
    flag = True
    for i in range(1,N):
      x,y,h = XYH[i]
      if ch != h + abs(x-cx) + abs(y-cy):
        flag = False
        break
    if flag:
      print(cx,cy,ch)
      exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

pts = []

for i in range(n):
    x, y, h = map(int, input().split())
    pts.append((x, y, h))

for y in range(0, 101):
    for x in range(0, 101):
        needH = -1
        for i in range(n):
            tmp = pts[i][2] + abs(y - pts[i][1]) + abs(x - pts[i][0])
            if needH == -1:
                needH = tmp
            else:
                if needH != tmp:
                    needH = -2
                    break
        if needH == -2:
            continue

        for i in range(n):
            if pts[i][2] == 0:
                dist = abs(y - pts[i][1]) + abs(x - pts[i][0])
                if needH > dist:
                    needH = -2
                    break

        if needH == -2:
            continue

        print('{0} {1} {2}'.format(x, y, needH))
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

pts = []

for i in range(n):
    x, y, h = map(int, input().split())
    pts.append((x, y, h))

for y in range(0, 101):
    for x in range(0, 101):
        needH = -1
        for i in range(n):
            tmp = pts[i][2] + abs(y - pts[i][1]) + abs(x - pts[i][0])
            if needH == -1:
                needH = tmp
            else:
                if needH != tmp:
                    needH = -2
                    break
        if needH == -2:
            continue

        for i in range(n):
            if pts[i][2] == 0:
                dist = abs(y - pts[0][1]) + abs(x - pts[0][0])
                if needH > dist:
                    needH = -2
                    break

        if needH == -2:
            continue

        print('{0} {1} {2}'.format(x, y, needH))
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

pts = []

for i in range(n):
    x, y, h = map(int, input().split())
    pts.append((x, y, h))

for y in range(0, 101):
    for x in range(0, 101):
        needH = -1
        for i in range(n):
            tmp = pts[0][2] + abs(y - pts[0][1]) + abs(x - pts[0][0])
            if needH == -1:
                needH = tmp
            else:
                if needH != tmp:
                    needH = -2
                    break
        if needH == -2:
            continue

        for i in range(n):
            if pts[i][2] == 0:
                dist = abs(y - pts[0][1]) + abs(x - pts[0][0])
                if needH > dist:
                    needH = -2
                    break

        if needH == -2:
            continue

        print('{0} {1} {2}'.format(x, y, needH))
        exit()

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.sort(key=lambda x:x[2],reverse=True)
x0,y0,h0=li[0]
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if i[2]!=0:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.sort(key=lambda x:x[2],reverse=True)
x0,y0,h0=li.pop(0)
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if i[2]!=0:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            else:
                if h<i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
li.sort(key=lambda x:x[2],reverse=True)
x0,y0,h0=li.pop(0)
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if i[2]!=0:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N-1)]
li.sort(key=lambda x:x[2],reverse=True)
x0,y0,h0=li.pop(0)
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if i[2]!=0:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
x0,y0,h0= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(N-1)]
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if i[2]!=0:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
x0,y0,h0= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(N-1)]
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            h=h0+abs(cx-x0)+abs(cy-y0)
            if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
for cx in range(101):
    for cy in range(101):
        h=-1
        check=0
        for i in li:
            if h==-1:
                h=i[2]+abs(cx-i[0])+abs(cy-i[1])
            else:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    break
            check+=1
            if check==N:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
h=0
for cx in range(101):
    for cy in range(101):
        check=0
        for i in li:
            if h==0:
                h=i[2]+abs(cx-i[0])+abs(cy-i[1])
            else:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    h=0
                    break
            check+=1
            if check==N:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
li=[list(map(int,input().split())) for _ in range(N)]
h=0
check=0
for cx in range(101):
    for cy in range(101):
        for i in li:
            if h==0:
                h=i[2]+abs(cx-i[0])+abs(cy-i[1])
                continue
            else:
                if h!=i[2]+abs(cx-i[0])+abs(cy-i[1]):
                    h=0
                    break
            check+=1
            if check==N-1:
                print(cx,cy,h)
                exit(0)

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]
 
for i in range(101):
  for j in range(101):
    check=True
    k=0
    while xyh[k][2]==0:
      k+=1
      
    h=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
    
    for k in range(N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if xyh[k][2]==0:
        if temph<=h:
          check=False
      else:
        if h!=temph:
          check=False
        
    if check==True and 0<h:
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]
 
for i in range(101):
  for j in range(101):
    check=True
    k=0
    while xyh[k][2]==0:
      k+=1
      
    h=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
    
    for k in range(N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if xyh[k][2]==0:
        if temph<=h:
          check=False
      else:
        if h!=temph:
          check=False
        
    if check==True and 0<h and h<=pow(10, 9):
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]
 
for i in range(101):
  for j in range(101):
    check=True
    k=0
    while xyh[k][2]==0:
      k+=1
      
    h=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
    
    for k in range(N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if h!=temph:
        check=False
        
    if check==True and 0<h and h<=pow(10, 9):
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]
 
for i in range(101):
  for j in range(101):
    check=True
    k=0
    while xyh[k][2]==0:
      k+=1
      
    h=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
    
    for k in range(N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if h!=temph:
        check=False
        
    if check==True and 0<=h and h<=pow(10, 9):
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]
 
for i in range(101):
  for j in range(101):
    check=True
    k=0
    while xyh[k][2]==0:
      k+=1
      
    h=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
    
    for k in range(1, N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if h!=temph:
        check=False
        
    if check==True and 0<=h and h<=pow(10, 9):
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]

for i in range(101):
  for j in range(101):
    check=True
    h=abs(xyh[0][0]-i)+abs(xyh[0][1]-j)+xyh[0][2]
    
    for k in range(1, N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if h!=temph:
        check=False
        
    if check:
      if 0<=h and h<=pow(10, 9):
        print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]

for i in range(101):
  for j in range(101):
    check=True
    h=abs(xyh[0][0]-i)+abs(xyh[0][1]-j)+xyh[0][2]
    
    for k in range(1, N):
      temph=abs(xyh[k][0]-i)+abs(xyh[k][1]-j)+xyh[k][2]
      if h!=temph:
        check=False
        
    if check:
      print(' '.join([str(i), str(j), str(h)]))

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
xyh=[list(map(int, input().split())) for i in range(N)]

def f(x, y, h):
  cand=np.zeros((101, 101))
  for i in range(101):
    for j in range(101):
      cand[i, j]=abs(x-i)+abs(y-j)+h
      
  return cand

output=f(xyh[0][0], xyh[0][1], xyh[0][2])
for p in xyh[1:]:
  cand=f(p[0], p[1], p[2])
  output[output!=cand]=0
  
index=np.argmax(output)
a=index//101
b=index%101
m=int(np.max(output))

print(' '.join([str(a), str(b), str(m)]))