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:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
info.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            # if x < 0 or y < 0 or h <= 0:
            #     continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if H != h + abs(cx - x) + abs(cy - y):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
info.sort(key=lambda x: x[2])
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            # if x < 0 or y < 0 or h <= 0:
            #     continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if H != h + abs(cx - x) + abs(cy - y):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []
not_zero = -100
flag_zero = True

for i in range(N):
    x,y,h = map(int,input().split())
    if h > 0 and flag_zero:
        not_zero = i
        flag_zero = False
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        H = xyh[not_zero][2] + abs(Cx-xyh[not_zero][0]) + abs(Cy-xyh[not_zero][1])
        ans = True

        for x,y,h in xyh:
            tmp_h = h+abs(Cx-x)+abs(Cy-y)
            if h>0:
                if tmp_h != H:
                    ans = False
                    break
           ##else:
                ##if H - abs(Cx-x) -abs(Cy-y) > 0:
                  ##  ans = False
                   ## break
            
        if ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []

for i in range(N):
    x,y,h = map(int,input().split())
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        ans = True
        flag_h = True

        for x,y,h in xyh:

            if h>0 and flag_h:
                H = h+abs(Cx-x)+abs(Cy-y)
                flag_h = False

            else:
                tmp_h = h+abs(Cx-x)+abs(Cy-y)
                if h>0:
                    if tmp_h != H:
                        ans = False
                        break
                else:
                    if tmp_h - abs(Cx-x) -abs(Cy-y) > 0:
                        ans = False
                        break
            
        if ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []

for i in range(N):
    x,y,h = map(int,input().split())
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        ans = True
        flag_h = True

        for x,y,h in xyh:

            if h>0 and flag_h:
                H = h+abs(Cx-x)+abs(Cy-y)
                flag_h = False

            elif h>0:
                tmp_h = h+abs(Cx-x)+abs(Cy-y)
                if tmp_h != H:
                    ans = False
                    ##break

        if ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []

for i in range(N):
    x,y,h = map(int,input().split())
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        ans = True
        flag_h = True
        count = 0

        for x,y,h in xyh:
            if h>0 and flag_h:
                H = h+abs(Cx-x)+abs(Cy-y)
                p_Cx = i
                p_Cy = j
                flag_h = False
                count += 1
            elif h>0:
                tmp_h = h+abs(Cx-x)+abs(Cy-y)
                count += 1
                if tmp_h != H:
                    ans = False
                    break
        if count == 1:
            print(p_Cx,p_Cy,H)
            exit()
        elif ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []

for i in range(N):
    x,y,h = map(int,input().split())
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):

        Cx = i
        Cy = j
        ans = True
        flag_h = True
        count = 0

        for x,y,h in xyh:
            if h>0 and flag_h:
                H = h+abs(Cx-x)+abs(Cy-y)
                p_Cx = i
                p_Cy = j
                flag_h = False
                count = 1
            elif h>0:
                tmp_h = h+abs(Cx-x)+abs(Cy-y)
                if tmp_h != H:
                    ans = False
                    break
        if count == 1:
            print(p_Cx,p_Cy,H)
        elif ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

xyh = []

for i in range(N):
    x,y,h = map(int,input().split())
    xyh.append([x,y,h])

for i in range(101):
    for j in range(101):
        Cx = i
        Cy = j
        ans = True
        flag_h = True
        for x,y,h in xyh:
            if h>0 and flag_h:
                H = h+abs(Cx-x)+abs(Cy-y)
                flag_h = False
            elif h>0:
                tmp_h = h+abs(Cx-x)+abs(Cy-y)
                if tmp_h != H:
                    ans = False
                    break
        if ans:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
point = 0
for i in range(101):
    for j in range(101):
        flag = True
        kizyun = False
        count = 0
        for a,b,c in li:
            if c != 0:
                count += 1
                if kizyun == False:
                    h = c+abs(a-i)+abs(b-j)
                    if h-abs(a-i)-abs(b-j) != c:
                        flag = False
                    kizyun = True
                else:
                    k = c+abs(a-i)+abs(b-j)
                    if h != k and kizyun == True:
                        flag = False
        if count == 1:
            print(a,b+1,c+1)
            exit()
        if flag == True:
            point += 1
            print(i,j,h)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
point = 0
for i in range(101):
    for j in range(101):
        flag = True
        kizyun = False
        count = 0
        for a,b,c in li:
            if c != 0:
                count += 1
                if kizyun == False:
                    h = c+abs(a-i)+abs(b-j)
                    if h-abs(a-i)-abs(b-j) != c:
                        flag = False
                    kizyun = True
                else:
                    k = c+abs(a-i)+abs(b-j)
                    if h != k and kizyun == True:
                        flag = False
            if count == 1:
                print(a,b,c)
                exit()
        if flag == True:
            point += 1
            print(i,j,h)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
for i in range(101):
    for j in range(101):
        flag = True
        kizyun = False
        for a,b,c in li:
            if c != 0:
                if kizyun == False:
                    h = c+abs(a-i)+abs(b-j)
                    kizyun = True
                else:
                    k = c+abs(a-i)+abs(b-j)
                    if h != k and kizyun == True:
                        flag = False
        if flag == True:
            print(i,j,h)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
for i in range(101):
    for j in range(101):
        h = li[0][2]+abs(li[0][0]-i)+abs(li[0][1]-j)
        flag = True
        for a,b,c in li:
            k = c+abs(a-i)+abs(b-j)
            if h != k:
                flag = False
        if flag == True:
            print(i,j,h)
            exit()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if x < 0 or y < 0 or h <= 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if H != h + abs(cx - x) + abs(cy - y):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            # if x < 0 or y < 0 or h <= 0:
            #     continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if x < 0 or y < 0 or h <= 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
ans = info[0]
for i in range(1, N):
    if ans[2] > info[i][2]:
        ans = info[i]
print(*ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
for i in range(N):
    info.append(list(map(int, input().split())))
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if x < 0 or y < 0 or h <= 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            height = max(H - abs(cx - x) - abs(cy - y), 0)
            if height == 0:
                continue
            else:
                if h != height:
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
print(*info[0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
H_min = 0
for i in range(N):
    info.append(list(map(int, input().split())))
    H_min = max(H_min, info[0][2])
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if x < 0 or y < 0 or h <= 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            exit()
print(*info[0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
H_min = 0
for i in range(N):
    info.append(list(map(int, input().split())))
    H_min = max(H_min, info[0][2])
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if x < 0 or y < 0 or h <= 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
H_min = 0
for i in range(N):
    info.append(list(map(int, input().split())))
    H_min = max(H_min, info[0][2])
# s = False
for cx in range(101):
    for cy in range(101):
        flag = True
        s = False
        for i in range(N):
            x, y, h = info[i]
            if h == 0:
                continue
            if not s:
                H = h + abs(cx - x) + abs(cy - y)
                s = True
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
info = []
H_min = 0
for i in range(N):
    info.append(list(map(int, input().split())))
    H_min = max(H_min, info[0][2])
for cx in range(101):
    for cy in range(101):
        flag = True
        for i in range(N):
            x, y, h = info[i]
            if i == 0:
                H = h + abs(cx - x) + abs(cy - y)
                continue
            else:
                if h != max(H - abs(cx - x) - abs(cy - y), 0):
                    flag = False
        if flag:
            print(cx, cy, H)
            break

Submission status: Wrong Answer

Solution code:
n = int(input())
points = [[int(v) for v in input().split()] for i in range(n)]

ans_list = []

a, b, c = points[0]
for x in range(0, 101):
    for y in range(0, 101):
        z = [ max(0, (r + abs(x - p) + abs(y - q))) for p, q, r in points ]
        if len(set(z)) == 1 and c + abs(x - a) + abs(y - b) > 0:
            print(x, y, c + abs(x - a) + abs(y - b))
            break

Submission status: Wrong Answer

Solution code:
n = int(input())
points = [[int(v) for v in input().split()] for i in range(n)]

ans_list = []

a, b, c = points[0]
for x in range(0, 101):
    for y in range(0, 101):
        z = [ (r + abs(x - p) + abs(y - q)) for p, q, r in points ]
        if len(set(z)) == 1 and c + abs(x - a) + abs(y - b) > 0:
            print(x, y, c + abs(x - a) + abs(y - b))
            break

Submission status: Wrong Answer

Solution code:

n = int(input())
points = [[int(v) for v in input().split()] for i in range(n)]

ans_list = []

a, b, c = points[0]
for x in range(0, 101):
    for y in range(0, 101):
        z = [ (r + abs(x - p) + abs(y - q)) for p, q, r in points ]
        if len(set(z)) == 1:
            print(x, y, c + abs(x - a) + abs(y - b))
            break

Submission status: Wrong Answer

Solution code:

n = int(input())
points = [[int(v) for v in input().split()] for i in range(n)]

ans_list = []

a, b, c = points[0]
for x in range(0, 101):
    for y in range(0, 101):
        h = abs(x - a) + abs(y - b) + c
        z = [ (h - abs(x - p) - abs(y - q)) == r for p, q, r in points ]
        if all(z):
            print(x, y, h)

Submission status: Wrong Answer

Solution code:
n = int(input())

xyh = [list(map(int,input().split()))for i in range(n)]
i = 0
while i<n:
    if xyh[i][2]==0:
        xyh.pop(i)
        n -= 1
    else: i += 1

for i in range(101):
    for j in range(101):
        base = xyh[0][2]+abs(xyh[0][0]-i)+abs(xyh[0][1]-j)
        for k in range(1, n):
            if xyh[k][2]==0: continue
            if base!=xyh[k][2]+abs(xyh[k][0]-i)+abs(xyh[k][1]-j): break
        else:
            print(i, j, base)
            exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

xyh = [list(map(int,input().split()))for i in range(n)]
while xyh[0][2]==0:
    xyh.pop(0)
    n -= 1

for i in range(101):
    for j in range(101):
        base = xyh[0][2]+abs(xyh[0][0]-i)+abs(xyh[0][1]-j)
        for k in range(1, n):
            if xyh[k][2]==0: continue
            if base!=xyh[k][2]+abs(xyh[k][0]-i)+abs(xyh[k][1]-j): break
        else:
            print(i, j, base)
            exit()

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>max_v and (1<=k[0]<=10**9):
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]

print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>max_v and (0<=k[0]<=10**9):
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]

print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>max_v:
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]
if ans_h>100:
    ans_h=100
print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h      
            if t_height-abs(x-cx)-abs(y-cy)<0:
                h=0
                t_height=abs(x-cx)+abs(y-cy)+h      
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>=max_v:
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]
print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>=max_v:
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]
print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
# ABC100 C - Pyramid
from collections import defaultdict as dd
n=int(input())
d=dd(int)
l=[]
for i in range(n):
    x,y,h=map(int,input().split())
    for cx in range(101):
        for cy in range(101):
            t_height=abs(x-cx)+abs(y-cy)+h
            if t_height>=1:
                l.append((t_height,cx,cy))

for ll in l:
    d[ll]+=1

max_v=0
ans_h=0
ans_x,ans_y=0,0
for k,v in d.items():
    if v>max_v:
        max_v=v
        ans_h=k[0]
        ans_x=k[1]
        ans_y=k[2]
print(ans_x,ans_y,ans_h)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        judge = 0
        if H >= 1:
            for w in information:
                if calc(i, j, w) != H:
                    judge = 1
                    break
            if judge:
                continue
            else:
                ans = [i, j, H]
                print(*ans)
                sys.exit()
        else:
            break

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


def judge(i, j, e, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j) == e


def judge_loop(i, j):
    x = 1
    for w in information:
        if judge(i, j, H, w):
            continue
        else:
            x = 0
            break
    return x


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        if H >= 1:
            if judge_loop(i, j):
                ans = [i, j, H]
                print(*ans)
                sys.exit()
        else:
            break

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


def judge(i, j, e, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j) == e


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        x = 1
        if H >= 1:
            for w in information:
                if judge(i, j, H, w):
                    continue
                else:
                    x = 0
                    break
            if x:
                ans = [i, j, H]
                print(*ans)
                sys.exit()
        else:
            break

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        judge = 0
        if H >= 1:
            for w in information:
                if calc(i, j, w) != H:
                    judge = 1
                    break
            if judge:
                continue
            else:
                ans = [i, j, H]
                print(*ans)
                sys.exit()
        else:
            break

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        judge = 0
        for w in information[1:]:
            if calc(i, j, w) != H:
                judge = 1
        if judge:
            continue
        else:
            ans = [i, j, H]
            print(*ans)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


for i in range(101):
    for j in range(101):
        H = calc(i, j, information[0])
        judge = 0
        for w in information[1:]:
            if calc(i, j, w) != H:
                judge = 1
                break
        if judge:
            continue
        else:
            ans = [i, j, H]
            print(*ans)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


ans = []
for i in range(101):
    for j in range(101):
        now = calc(i, j, information[0])
        for w in information[1:]:
            if now != calc(i, j, w):
                now = 0
                break
        if now > 0:
            ans = [i, j, now]
            break

print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


now = -1
ans = []
for i in range(101):
    for j in range(101):
        for w in information:
            if now == -1:
                now = calc(i, j, w)
            elif now != calc(i, j, w):
                now = -1
                break
        if now != -1:
            ans = [i, j, now]
            break

print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]


def calc(i, j, w):
    x, y, h = w
    return h + abs(x-i) + abs(y-j)


now = -1
ans = []
for i in range(101):
    for j in range(101):
        for w in information:
            if now == -1:
                now = calc(i, j, w)
            elif now != calc(i, j, w):
                now = -1
                break
        if now != -1:
            ans = [i, j, now]
            break
    if now != -1:
        break


print(*ans)

Submission status: Wrong Answer

Solution code:
from sys import setrecursionlimit
from operator import itemgetter

def main():
    N = int(input())
    XYH = [list(map(int,input().split())) for _ in range(N)]
    XYH.sort(key = itemgetter(2))
    ansx = -1
    ansy = -1
    for cx in range(0,101):
        for cy in range(0,101):
            H = -1
            flag = True
            for x,y,h in XYH:
                if H >= 0:
                    if h != max(H - abs(x - cx) - abs(y - cy),0):
                        flag = False
                        break
                elif h > 0:
                    H =  h + abs(x - cx) + abs(y - cy)
            if flag:
                ansx = cx
                ansy = cy
                print(ansx,ansy,H)
                return
    return   

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from sys import setrecursionlimit


def main():
    N = int(input())
    XYH = [list(map(int,input().split())) for _ in range(N)]
    ansx = -1
    ansy = -1
    for cx in range(0,101):
        for cy in range(0,101):
            H = -1
            flag = True
            for x,y,h in XYH:
                if H >= 0:
                    if H - abs(x - cx) - abs(y - cy) >= 0:
                        if h != H - abs(x - cx) - abs(y - cy):
                            flag = False
                            break
                elif h > 0:
                    H =  h + abs(x - cx) + abs(y - cy)
            if flag:
                ansx = cx
                ansy = cy
                print(ansx,ansy,H)
                return
    return   

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
li = [list(map(int,input().split())) for i in range(N)]
# print(li)
index= 0
for index,i in enumerate(li):
	if i[2] >0:
	 	s=index
	 	break

# print(index)
for x in range(101):
	for y in range(101):
		h = li[index][2] + abs(x-li[index][0]) + abs(y - li[index][1])
		ok = True
		for i in li:
			if i[2] > 0 and h!= i[2] + abs(x-i[0])+abs(y-i[1]):
				ok = False
			if i[2] == 0 and h> i[2] + abs(x-i[0])+abs(y-i[1]):
				ok = False
		if ok:
			ans = [x,y,h]
print(x,y,h)

Submission status: Wrong Answer

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

s = 0

for index, i in enumerate(li):
  if i[2] > 0:
    s = index
    break
  
for x in range(101):
  for y in range(101):
    h = li[s][2] + abs(x - li[s][0]) + abs(y - li[s][1])
    ok = True

    for i in li:
      if i[2] > 0 and h != i[2] + abs(x - i[0]) + abs(y - i[1]):
        ok = False

    if ok:
      ans = [x, y, h]

print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

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

s = 0

for index, i in enumerate(li):
  if i[2] > 0:
    s = index
  
for x in range(101):
  for y in range(101):
    h = li[s][2] + abs(x - li[s][0]) + abs(y - li[s][1])
    ok = True

    for i in li:
      if i[2] > 0 and h != i[2] + abs(x - i[0]) + abs(y - i[1]):
        ok = False

    if ok:
      ans = [x, y, h]

print("{} {} {}".format(ans[0], ans[1], ans[2]))