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:
N = int(input())
para = [[i for i in map(int,input().split())] for j in range(N)]

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        flag = True
        for i in range(N):
            if para[i][2] >= 1 :
                if H == 0 :
                    H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                    continue
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    continue

                flag = False 
        if flag :        
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        flag = True
        for i in range(N):
            if para[i][2] >= 1 :
                if H == 0 :
                    H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                elif H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    pass
                else : 
                    flag = False
        if flag :        
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        for i in range(N):
            if para[i][2] >= 1 :
                if H == 0 :
                    H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                elif H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    continue
                else : break

            else : continue
        
        print("{} {} {}".format(c_x,c_y,H))
        exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        cnt = 0
        for i in range(N):
            if H == 0 :
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                cnt += 1
            elif para[i][2] == 0 :
                cnt += 1
                continue
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    cnt += 1
                else : pass
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        cnt = 0
        for i in range(N):
            if i == 0 :
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                cnt += 1

            elif para[i][2] == 0 :
                cnt += 1
                continue
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    cnt += 1
                else : break
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        cnt = 1
        for i in range(N):
            if H == 0 :
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
            elif para[i][2] == 0 :
                cnt += 1
                continue
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    cnt += 1
                else : break
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        cnt = 1
        for i in range(N):
            if H == 0 and para[i][2] != 0:
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
            elif para[i][2] == 0 :
                continue
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2] :
                    cnt += 1
                else : break
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(0,101):
    for c_y in range(0,101):
        H = 0
        cnt = 1
        for i in range(N):
            if i == 0 :
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]:
                    cnt += 1
                else : break
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for c_x in range(1,101):
    for c_y in range(1,101):
        H = 0
        cnt = 1
        for i in range(N):
            if i == 0 :
                H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
            else :
                if H == abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]:
                    cnt += 1
                else : break
        if cnt == N :
            print("{} {} {}".format(c_x,c_y,H))
            exit()

Submission status: Wrong Answer

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

for Cx in range(101):        # x
    for Cy in range(101):    # y
        flg=True
        k=0
        while xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy) <1 or xyh[k][2]<1:
            k+=1
        H=xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy)
        for i in range(len(xyh)):
            if H!=xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy):
                flg=False
        if flg:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

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

for Cx in range(101):        # x
    for Cy in range(101):    # y
        flg=True
        k=0
        while xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy) <1:
            k+=1
        H=xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy)
        for i in range(len(xyh)):
            if H!=xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy) and xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy)>=1:
                flg=False
        if flg:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

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

for Cx in range(101):        # x
    for Cy in range(101):    # y
        flg=True
        k=0
        while xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy) <1:
            k+=1
        H=xyh[k][2]+abs(xyh[k][0]-Cx)+abs(xyh[k][1]-Cy)
        for i in range(len(xyh)):
            if H!=xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy):
                flg=False
        if flg:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

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

for Cx in range(101):        # x
    for Cy in range(101):    # y
        flg=True
        H=xyh[0][2]+abs(xyh[0][0]-Cx)+abs(xyh[0][1]-Cy)
        if H<1:
            flg=False
        for i in range(len(xyh)):
            if H!=xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy):
                flg=False
        if flg:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

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

for Cx in range(101):        # x
    for Cy in range(101):    # y
        flg=True
        H=xyh[0][2]+abs(xyh[0][0]-Cx)+abs(xyh[0][1]-Cy)
        for i in range(len(xyh)):
            if H!=xyh[i][2]+abs(xyh[i][0]-Cx)+abs(xyh[i][1]-Cy):
                flg=False
        if flg:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1 and list(hset)[0] != 0:
      flag = True
      for i in range(N):
        xyhi = xyh[i]
        if xyhi[2] != 0:
          continue
        elif xyhi[2] == 0 and list(hset)[0] - abs(xyhi[0]-x) - abs(xyhi[1]-y) == 0:
          continue
        flag = False
        break
      if flag:
        ansx = x
        ansy = y
        ansh = list(hset)[0]

print(ansx, ansy, ansh)

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    flag = True
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1 and list(hset)[0] != 0:
      ansx = x
      ansy = y
      ansh = list(hset)[0]

print(ansx, ansy, ansh)

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    flag = True
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1:
      ansx = x
      ansy = y
      ansh = list(hset)[0]

print(ansx, ansy, ansh)

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    flag = True
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1 and abs(xyh[0][0]-x) + abs(xyh[0][1]-y) + xyh[0][2] != 0:
      ansx = x
      ansy = y
      ansh = abs(xyh[0][0]-x) + abs(xyh[0][1]-y) + xyh[0][2]

print(ansx, ansy, ansh)

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    flag = True
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1:
      ansx = x
      ansy = y
      ansh = abs(xyh[0][0]-x) + abs(xyh[0][1]-y) + xyh[0][2]

print(ansx, ansy, ansh)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [0]*N
Y = [0]*N
H = [0]*N
for i in range(N):
    X[i],Y[i],H[i] = map(int, input().split())

# print(N, X, Y, H)

point = []
for n in range(N):
    if H[n] != 0:
        point = [X[n], Y[n], H[n]]
        break

ans = []
same = True
for i in range(101):
    for j in range(101):
        same = True
        height = max(point[2] + abs(point[0] - i) + abs(point[1] - j), 0)
        if height == 0:
            same = False
            continue
        for n in range(N):
            x = X[n]
            y = Y[n]
            h = H[n]
            candidate = max(h + abs(x - i) + abs(y - j), 0)
            if candidate != height:
                same = False
                break
        if same:
            ans = [i, j, height]
            break
    if same:
        break

if same:
    print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [0]*N
Y = [0]*N
H = [0]*N
for i in range(N):
    X[i],Y[i],H[i] = map(int, input().split())

# print(N, X, Y, H)

point = []
for n in range(N):
    if H[n] != 0:
        point = [X[n], Y[n], H[n]]
        break

ans = []
same = True
for i in range(101):
    for j in range(101):
        same = True
        height = max(point[2] + abs(point[0] - i) + abs(point[1] - j), 0)
        if height == 0:
            continue
        for n in range(N):
            x = X[n]
            y = Y[n]
            h = H[n]
            candidate = max(h + abs(x - i) + abs(y - j), 0)
            if candidate != height:
                same = False
                break
        if same:
            ans = [i, j, height]
            break
    if same:
        break

if same:
    print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [0]*N
Y = [0]*N
H = [0]*N
for i in range(N):
    X[i],Y[i],H[i] = map(int, input().split())

# print(N, X, Y, H)

point = []
for n in range(N):
    if H[n] != 0:
        point = [X[n], Y[n], H[n]]
        break

ans = []
same = True
for i in range(101):
    for j in range(101):
        same = True
        height = max(point[2] + abs(point[0] - i) + abs(point[1] - j), 0)
        for n in range(N):
            x = X[n]
            y = Y[n]
            h = H[n]
            candidate = max(h + abs(x - i) + abs(y - j), 0)
            if candidate != height:
                same = False
                break
        if same:
            ans = [i, j, height]
            break
    if same:
        break

if same:
    print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [0]*N
Y = [0]*N
H = [0]*N
for i in range(N):
    X[i],Y[i],H[i] = map(int, input().split())

# print(N, X, Y, H)

point = []
for n in range(N):
    if H[n] != 0:
        point = [X[n], Y[n], H[n]]
        break

ans = []
same = True
for i in range(101):
    for j in range(101):
        same = True
        height = point[2] + abs(point[0] - i) + abs(point[1] - j)
        for n in range(N):
            x = X[n]
            y = Y[n]
            h = H[n]
            candidate = h + abs(x - i) + abs(y - j)
            if candidate != height:
                same = False
                break
        if same:
            ans = [i, j, height]
            break
    if same:
        break

if same:
    print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
X = [0]*N
Y = [0]*N
H = [0]*N
for i in range(N):
    X[i],Y[i],H[i] = map(int, input().split())

# print(N, X, Y, H)

point = []
for n in range(N):
    if H[n] != 0:
        point = [X[n], Y[n], H[n]]
        break

ans = []
same = True
for i in range(101):
    for j in range(101):
        same = True
        height = point[2] + abs(point[0] - i) + abs(point[1] - j)
        for n in range(N):
            x = X[n]
            y = Y[n]
            h = H[n]
            candidate = h + abs(x - i) + abs(y - j)
            if candidate != height:
                same = False
                break
        if same:
            ans = [i, j, height]
            break
    if same:
        break

if same:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
 
cor = [0] * N
 
for i in range(N):
    cor[i] = list(map(int, input().split()))

maximum_h = max([cor[i][2] for i in range(N)])
for x in range(101):
    for y in range(101):
        Height_list = [item[2] + abs(item[0] - x) + abs(item[1] - y) for item in cor if item[2] >= 1]
        print(Height_list)
        if len(list(set(Height_list))) == 1 and Height_list[0] >= maximum_h:
            print(x, y, Height_list[0])
            sys.exit()
            break

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

cor = [0] * N

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

height = {}
maximum_h = max([cor[i][2] for i in range(N)])

for x in range(101):
    for y in range(101):
        Height_list = [item[2] + abs(item[0] - x) + abs(item[1] - y) for item in cor]
        if len(list(set(Height_list))) == 1 and Height_list[0] >= maximum_h and Height_list[0] >= 1:
            height[Height_list[0]] = [x, y]

for item in sorted(height.items(), key=lambda x: x[0], reverse=True):
    print(item[0], item[1][0], item[1][1])
    break
    sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

cor = [0] * N

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

maximum_h = max([cor[i][2] for i in range(N)])
for x in range(101):
    for y in range(101):
        Height_list = [item[2] + abs(item[0] - x) + abs(item[1] - y) for item in cor]
        if len(list(set(Height_list))) == 1 and Height_list[0] >= maximum_h:
            print(x, y, Height_list[0])
            sys.exit()
            break

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

cor = [0] * N

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


for x in range(101):
    for y in range(101):
        Height_list = [item[2] + abs(item[0] - x) + abs(item[1] - y) for item in cor]
        if len(list(set(Height_list))) == 1:
            print(x, y, Height_list[0])
            sys.exit()
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
for cx in range(101):
    for cy in range(101):
        H = 0
        ok = True
        for i in range(N):
            x,y,h = xyh[i]
            if h != 0:
                if H == 0:
                    H = h+abs(cx-x)+abs(cy-y)
                else:
                    ok = H==h+abs(cx-x)+abs(cy-y)
            if not ok:
                break
        if ok:
            break
    if ok:
        break

if H == 0:
    for cx0 in range(101):
        for cy0 in range(101):
            for i in range(N):
                x,y,h = xyh[i]
                if H <= h+abs(cx0-x)+abs(cy0-y):
                    cx,cy=cx0,cy0
                    H = h+abs(cx0-x)+abs(cy0-y)
    
print('{} {} {}'.format(cx,cy,H))

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
for cx in range(101):
    for cy in range(101):
        H = 0
        ok = True
        for i in range(N):
            x,y,h = xyh[i]
            if h != 0:
                if H == 0:
                    H = h+abs(cx-x)+abs(cy-y)
                else:
                    ok = H==h+abs(cx-x)+abs(cy-y)
            if not ok:
                break
        if ok:
            break
    if ok:
        break
if H == 0:
    for cx in range(101):
        for cy in range(101):
            for i in range(N):
                x,y,h = xyh[i]
                H = max(H,h+abs(cx-x)+abs(cy-y))
    
print('{} {} {}'.format(cx,cy,H))

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
for cx in range(101):
    for cy in range(101):
        H = 0
        ok = True
        for i in range(N):
            x,y,h = xyh[i]
            if h != 0:
                if H == 0:
                    H = h+abs(cx-x)+abs(cy-y)
                else:
                    ok = H==h+abs(cx-x)+abs(cy-y)
            if not ok:
                break
        if ok:
            break
    if ok:
        break
print('{} {} {}'.format(cx,cy,H))

Submission status: Wrong Answer

Solution code:
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

for cx in range(101):
    for cy in range(101):
        flag = True
        H = h[0] + abs(x[0] - cx) + abs(y[0] - cy)
        if H < 1:
            flag = False
        for i in range(1, N):
            if H != h[i] + abs(x[i] - cx) + abs(y[i] - cy):
                flag = False
        if flag:
            print(cx, cy, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())

A = []
for i in range(N):
    x,y,h = map(int, input().split())
    A.append([x,y,h])
for i in range(100+1):
    for j in range(100+1):
        lst = {}
        for x,y,h in A:
            if h == 0:
                continue
            tx, ty = abs(x-i), abs(y-j)
            H = h + tx + ty
            if H not in lst:
                lst[H] = 1
            else :
                lst[H] += 1
        if len(lst) == 1 and [lst.keys()][0] != 0:
            print(i,j,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

A = []
for i in range(N):
    x,y,h = map(int, input().split())
    A.append([x,y,h])
for i in range(100+1):
    for j in range(100+1):
        lst = {}
        for x,y,h in A:
            if h == 0:
                continue
            tx, ty = abs(x-i), abs(y-j)
            H = h + tx + ty
            if H not in lst:
                lst[H] = 1
            else :
                lst[H] += 1
        if len(lst) == 1:
            print(i,j,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

A = []
for i in range(N):
    x,y,h = map(int, input().split())
    A.append([x,y,h])
for i in range(100+1):
    for j in range(100+1):
        lst = {}
        for x,y,h in A:
            tx, ty = abs(x-i), abs(y-j)
            H = h + tx + ty
            if H not in lst:
                lst[H] = 1
            else :
                lst[H] += 1
        if len(lst) == 1:
            print(i,j,H)

Submission status: Wrong Answer

Solution code:
n = int(input())

x = []
y = []
h = []

for i in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp[0])
    y.append(tmp[1])
    h.append(tmp[2])

# for i in range(n):
#     if h[i] >= 1:
#         t = i
#         break

t = h.index(max(h))

for cy in range(101):
    for cx in range(101):
        H = h[t] + abs(x[t] - cx) + abs(y[t] - cy)
        for i in range(n):
            if h[i] != H - abs(cx - x[i]) - abs(cy - y[i]):
                break
            if i == n - 1:
                print('{} {} {} '.format(cx, cy, H))

Submission status: Wrong Answer

Solution code:
n = int(input())

x = []
y = []
h = []

for i in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp[0])
    y.append(tmp[1])
    h.append(tmp[2])

t = h.index(max(h))

for i in range(n):
    if h[i] >= 1:
        t = i
        break

for cy in range(101):
    for cx in range(101):
        H = h[t] + abs(x[t] - cx) + abs(y[t] - cy)
        for i in range(n):
            if h[i] != H - abs(cx - x[i]) - abs(cy - y[i]):
                break
            if i == n - 1:
                print('{} {} {} '.format(cx, cy, H))

Submission status: Wrong Answer

Solution code:
n = int(input())

x = []
y = []
h = []

for i in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp[0])
    y.append(tmp[1])
    h.append(tmp[2])

for i in range(n):
    if h[i] >= 1:
        t = i
        break

for cy in range(101):
    for cx in range(101):
        H = h[t] + abs(x[t] - cx) + abs(y[t] - cy)
        for i in range(n):
            if h[i] != H - abs(cx - x[i]) - abs(cy - y[i]):
                break
            if i == n - 1:
                print('{} {} {} '.format(cx, cy, H))


# h = max(H - abs(X - cx) - abs(Y - cy) ,0)

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    conds = [list(map(int, input().split(" "))) for i in range(N)]
    
    # [[cx, cy, H]]
    candidates = []

    cond = sorted(conds, reverse=True, key=lambda x:x[2])[0]
    for cx in range(101):
        for cy in range(101):
            H = abs(cond[0]-cx)+abs(cond[1]-cy)+cond[2]
            candidates.append([cx, cy, H])
    
    ans = []
    for cand in candidates:
        ansflg = True
        for n in range(1, N):
            cond = conds[n]
            if cond[2] == 0:
                if abs(cond[0]-cand[0])+abs(cond[1]-cand[1]) < cond[2]: 
                    ansflg = False
                    break
            else:
                H = abs(cond[0]-cand[0])+abs(cond[1]-cand[1])+cond[2]
                if H != cand[2]:
                    ansflg = False
                    break
        if ansflg:
            ans = cand
            break
    
    print("{} {} {}".format(ans[0], ans[1], ans[2]))

    


if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    conds = [list(map(int, input().split(" "))) for i in range(N)]
    
    # [[cx, cy, H]]
    candidates = []

    cond = sorted(conds, reverse=True, key=lambda x:x[2])[0]
    for cx in range(101):
        for cy in range(101):
            H = abs(cond[0]-cx)+abs(cond[1]-cy)+cond[2]
            if 1 <= H:
                candidates.append([cx, cy, H])
    
    ans = []
    for cand in candidates:
        ansflg = True
        for n in range(1, N):
            cond = conds[n]
            if cond[2] == 0:
                if abs(cond[0]-cand[0])+abs(cond[1]-cand[1]) < cond[2]: 
                    ansflg = False
                    break
            else:
                H = abs(cond[0]-cand[0])+abs(cond[1]-cand[1])+cond[2]
                if H != cand[2]:
                    ansflg = False
                    break
        if ansflg:
            ans = cand
            break
    
    print("{} {} {}".format(ans[0], ans[1], ans[2]))

    


if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())
XYH = [list(map(int,input().split())) for i in range(N)]
for Cx in range(101):
    for Cy in range(101):
        H = XYH[0][2]+abs(XYH[0][0]-Cx)+abs(XYH[0][1]-Cy)
        cnt = 0
        for X,Y,h in XYH:
            if h == max(H-abs(X-Cx)-abs(Y-Cy),0):
                    cnt += 1
        if cnt == N:
            print(Cx,Cy,H)
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
XYH = [list(map(int,input().split())) for i in range(N)]
for Cx in range(101):
    for Cy in range(101):
        H = XYH[0][2]+abs(XYH[0][0]-Cx)+abs(XYH[0][1]-Cy)
        cnt = 0
        for X,Y,h in XYH:
            if h == 0:
                cnt += 1
            else:
                if H == h+abs(X-Cx)+abs(Y-Cy):
                    cnt += 1
        if cnt == N:
            print(Cx,Cy,H)
            break

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()

st=set()
prevset=set()
for i in range(N):
    x,y,h=LI()
    st = set()
    for i in range(101):
        for j in range(101):
            st.add((i,j, h+abs(x-i)+abs(y-j)))

    prevset = st if not prevset else st.intersection(prevset)
    if len(prevset) == 1:
        break

print(*prevset.pop())

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()

st=set()
for i in range(N):
    x,y,h=LI()
    # 初回
    if h != 0 and not st:
        for i in range(101):
            for j in range(101):
                st.add((i,j, h+abs(x-i)+abs(y-j)))
    else:
        newone = set()
        for i,j,k in st:
            if h == max(k-abs(x-i)-abs(y-j),0):
                newone.add((i,j,k))
        if len(newone) == 1:
            print(*newone.pop())
            exit()
        st = newone

Submission status: Wrong Answer

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
X, Y, H = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))

H = np.array(H)
# H == 0 は役に立たないので消す
X = np.array(X)[H > 0]
Y = np.array(Y)[H > 0]
H = H[H > 0]

ans = []
for cx in range(101):
    for cy in range(101):
        ch = abs(X[0] - cx) + abs(Y[0] - cy) + H[0]
        ok = True
        for x, y, h in zip(X, Y, H):
            if ch != abs(x - cx) + abs(y - cy) + h:
                ok = False
                break
        if ok:
            ans = cx, cy, ch

print(*ans)

Submission status: Wrong Answer

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
X, Y, H = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))

ans = []
for cx in range(101):
    for cy in range(101):
        ch = abs(X[0] - cx) + abs(Y[0] - cy) + H[0]
        ok = True
        for x, y, h in zip(X, Y, H):
            if ch != abs(x - cx) + abs(y - cy) + h:
                ok = False
                break
        if ok:
            ans = cx, cy, ch

print(*ans)