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:
# Pyramid
n = int(input())
x, y, h = [], [], []
flag = True
ans_x, ans_y, ans_h = 0, 0, 0
for i in range(n):
    _x_, _y_, _h_ = map(int, input().split())
    if _h_ == 0:
        break
    x.append(_x_)
    y.append(_y_)
    h.append(_h_)
for cx in range(101):
    for cy in range(101):
        for j in range(len(x)):
            h_ = h[j] + abs(x[j] - cx) + abs(y[j] - cy)
            if flag is True:
                flag = h_
            elif flag == h_:
                if j == n - 1:
                    ans_x, ans_y, ans_h = cx, cy, h_
                else:
                    pass
            else:
                flag = True
                break
print('{0} {1} {2}'.format(ans_x, ans_y, ans_h))

Submission status: Wrong Answer

Solution code:
# Pyramid
n = int(input())
x, y, h = [], [], []
flag = True
ans_x, ans_y, ans_h = 0, 0, 0
for i in range(n):
    _x_, _y_, _h_ = map(int, input().split())
    x.append(_x_)
    y.append(_y_)
    h.append(_h_)
for cx in range(101):
    for cy in range(101):
        for j in range(n):
            h_ = h[j] + abs(x[j] - cx) + abs(y[j] - cy)
            if flag is True:
                flag = h_
            elif flag == h_:
                if j == n - 1:
                    ans_x, ans_y, ans_h = cx, cy, h_
                else:
                    pass
            else:
                flag = True
                break
print('{0} {1} {2}'.format(ans_x, ans_y, ans_h))

Submission status: Wrong Answer

Solution code:
# Pyramid
n = int(input())
x, y, h = [], [], []
flag = None
ans_x, ans_y, ans_h, num = 0, 0, 0, 0
for i in range(n):
    _x_, _y_, _h_ = map(int, input().split())
    x.append(_x_)
    y.append(_y_)
    h.append(_h_)
for cx in range(101):
    for cy in range(101):
        for j in range(n):
            num = abs(cx - x[j]) + abs(cy - y[j])
            h_ = num + h[j]
            if flag is None:
                flag = h_
            elif flag == h_:
                if j == n - 1:
                    ans_x, ans_y, ans_h = cx, cy, h_
                else:
                    pass
            else:
                flag = None
                break
print('{0} {1} {2}'.format(ans_x, ans_y, ans_h))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
def mh(x1,y1,x2,y2):
  return abs(x1-x2)+abs(y1-y2)

ri = 0
rj = 0
rh = 0
m = 0
for i in range(n):
  if a[i][2] != 0:
    m = i
    break
for i in range(101):
  for j in range(101):
    h = a[m][2]+mh(i,j,a[m][0],a[m][1])
    if all(max(h-mh(a[k][0],a[k][1],i,j),0) == a[k][2] for k in range(1,n)):
      ri = i
      rj = j
      rh = h
      break
      
print(ri,"",rj,"",rh)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
def mh(x1,y1,x2,y2):
  return abs(x1-x2)+abs(y1-y2)

ri = 0
rj = 0
rh = 0
for i in range(101):
  for j in range(101):
    h = a[0][2]+mh(i,j,a[0][0],a[0][1])
    if all(max(h-mh(a[k][0],a[k][1],i,j),0) == a[k][2] for k in range(1,n)):
      ri = i
      rj = j
      rh = h
      break
      
print(ri,"",rj,"",rh)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
def mh(x1,y1,x2,y2):
  return abs(x1-x2)+abs(y1-y2)

ri = 0
rj = 0
rh = 0
for i in range(101):
  for j in range(101):
    h = a[0][2]+mh(i,j,a[0][0],a[0][1])
    if all(h-mh(a[k][0],a[k][1],i,j) == a[k][2] for k in range(1,n)):
      ri = i
      rj = j
      rh = h
      break
      
print(ri,"",rj,"",rh)

Submission status: Wrong Answer

Solution code:
r=range(int(input()))
p=[[int(i)for i in input().split()] for _ in r]

a,b,c=p[0]
for x in range(101):
  for y in range(101):
    h=c+abs(a-x)+abs(b-y)
    if all(k==max(h-abs(i-x)-abs(j-y),0) for i,j,k in p):
      print(x,y,h)
      exit()

Submission status: Wrong Answer

Solution code:
r=range(int(input()))
p=[[int(i)for i in input().split()] for _ in r]

a,b,c=p[0]
for x in range(101):
  for y in range(101):
    h=c+abs(a-x)+abs(b-y)
    if all(k==h-abs(i-x)-abs(j-y) for i,j,k in p):
      print(x,y,h)
      exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
co = []

for i in range(N):
    tmp_x,tmp_y,tmp_h = map(int,input().split())
    if tmp_h == 0:
        continue
    co.append((tmp_x,tmp_y,tmp_h))
N = len(co)

flag = True
for cx in range(101):
    if not flag:
        break
    for cy in range(101):
        H = abs(cx-co[0][0])+abs(cy-co[0][1])+co[0][2]
        for i in range(1,N):
            x,y,h = co[i]
            if H - h != abs(cx-x) + abs(cy-y):  
                break
        else:
            result = (cx,cy,H)
            flag = False
            break
        
print("%d %d %d" % (result[0],result[1],result[2]))

Submission status: Wrong Answer

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


height = []
for i in range(101):
    for j in range(101):
        height.clear()
        for k in range(N):
            temp = max(abs(x[k]-i) + abs(y[k]-j) + h[k], 0)
            height.append(temp)

        if len(set(height)) == 1 and height[0] != 0:
            print(i,j,height[0])

Submission status: Wrong Answer

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


height = []
for i in range(101):
    for j in range(101):
        height.clear()
        for k in range(N):
            temp = max(abs(x[k]-i) + abs(y[k]-j) + h[k], 0)
            height.append(temp)

        if len(set(height)) == 1:
            print(i,j,height[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
for c_x in range(0,101):
    for c_y in range(0,101):
        H_set = set()
        for x_i,y_i,h_i in data:
            if int((h_i + abs(x_i - c_x) + abs(y_i - c_y))) >= 1:
                H_set.add(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
for c_x in range(0,101):
    for c_y in range(0,101):
        H_set = list()
        for x_i,y_i,h_i in data:
            if int((h_i + abs(x_i - c_x) + abs(y_i - c_y))) >= 1:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
for c_x in range(0,101):
    for c_y in range(0,101):
        H_set = list()
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 1:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
for c_x in range(0,101):
    for c_y in range(0,101):
        H_set = list()
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
            exit()

Submission status: Wrong Answer

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

for i in range(0,N):
    if h[i] == 0:
        x[i] = -1
        y[i] = -1
        h[i] = -1

l = x.count(-1)
for i in range(0,l):
    x.remove(-1)
    y.remove(-1)
    h.remove(-1)

M = len(x)
H = [0 for i in range(0,M)]

for X in range(0,101):
    for Y in range(0,101):
        for i in range(0,M):
            H[i] = h[i] + abs(x[i]-X) + abs(y[i]-Y)
        if max(H) == min(H):
            print("{} {} {}".format(X,Y,max(H)))

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,101):
    for c_y in range(0,101):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
            sys.exit()
        H_set = list()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,101):
    for c_y in range(0,101):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
        H_set = list()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,101):
    for c_y in range(0,101):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
        else:
            H_set = list()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,101):
    for c_y in range(0,101):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
            exit()
        else:
            H_set = list()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,101):
    for c_y in range(0,101):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
        else:
            H_set = list()
            continue

Submission status: Wrong Answer

Solution code:
N = int(input())
data = list()
for i in range(N):
    x,y,h = (int(i) for i in input().split())
    data.append((x,y,h))
H_set = list()
for c_x in range(0,10):
    for c_y in range(0,10):
        for x_i,y_i,h_i in data:
            if (h_i + abs(x_i - c_x) + abs(y_i - c_y)) >= 0:
                H_set.append(int(h_i + abs(x_i - c_x) + abs(y_i - c_y)))
        H_set = set(H_set)
        if len(H_set) == 1:
            H_set = list(H_set)
            print(c_x,c_y,H_set[0])
            exit()
        else:
            H_set = list()
            continue

Submission status: Wrong Answer

Solution code:
def f(x, y, cx, cy):
    return abs(cx - x) + abs(cy - y)

n = int(input())
x = [0]*n
y = [0]*n
h = [0]*n
MAX = 10**9 + 1
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):
        maxH = MAX
        res = 0
        isAnswer = True
        for i in range(n):
            if h[i] == 0:
                maxH = min(maxH, f(x[i], y[i], cx, cy))
            else:
                curH = h[i] + f(x[i], y[i], cx, cy)
                if res == 0:
                    res = curH
                elif curH != res:
                    isAnswer = False
                    break
        if isAnswer and res <= maxH:
            print(cx, cy, res)
            cy = cx = 101

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[]
for j in range(N):
    a=[int(i) for i in input().split()]
    A.append(a)
for i in range(0,101):
    for j in range(0,101):
        HH=[]
        for k in range(N):
            if A[k][2]==0:
                if 1>abs(A[k][0]-i)+abs(A[k][1]-j):
                    break
                else:
                    if k==N-1:
                        print("{} {} {}".format(i,j,HH[0]))
                    else:
                        continue
            else:
                H=A[k][2]+abs(A[k][0]-i)+abs(A[k][1]-j)
                if len(HH)==0:
                    HH.append(H)
                    continue
                if H in HH:
                    HH.append(H)
                    if k==N-1:
                        print("{} {} {}".format(i,j,H))
                        break
                    else:
                        continue
                else:
                    break

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[]
for j in range(N):
    a=[int(i) for i in input().split()]
    A.append(a)
for i in range(0,101):
    for j in range(0,101):
        HH=[]
        for k in range(N):
            if A[k][2]==0:
                if 1>abs(A[k][0]-i)+abs(A[k][1]-j):
                    break
                else:
                    continue
            else:
                H=A[k][2]+abs(A[k][0]-i)+abs(A[k][1]-j)
                if len(HH)==0:
                    HH.append(H)
                    continue
                if H in HH:
                    HH.append(H)
                    if k==N-1:
                        print("{} {} {}".format(i,j,H))
                        break
                    else:
                        continue
                else:
                    break

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [[int(i) for i in input().split()] for j in range(N)]
for i in range(0,101):
    for j in range(0,101):
        H0 = max([xyh[0][2] + abs(i-xyh[0][0]) + abs(j-xyh[0][1]),0])
        flag = True
        for k in xyh:
            x = k[0] ; y = k[1] ; h = k[2]
            H = max([h+abs(i-x)+abs(j-y),0])
            if H0 != H:
                flag = False
                break
        if flag == True:
            break
    if flag == True:
        break
print (*[i,j,H])

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [[int(i) for i in input().split()] for j in range(N)]
for i in range(0,101):
    for j in range(0,101):
        H0 = xyh[0][2] + abs(i-xyh[0][0]) + abs(j-xyh[0][1])
        flag = True
        for k in xyh:
            x = k[0] ; y = k[1] ; h = k[2]
            H = h+abs(i-x)+abs(j-y)
            if H0 != H:
                flag = False
                break
        if flag == True:
            break
    if flag == True:
        break
print (*[i,j,H])

Submission status: Wrong Answer

Solution code:
N=int(input())
line=[list(map(int,input().split())) for i in range(N)]
for i in range(101):
    for j in range(101):
        a=[]
        for k in line:
            if k[2]!=0:
                a.append(k[2]+abs(i-k[0])+abs(j-k[1]))
        if len(set(a))==1:
            print(i,j,a[0])
            exit()

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-

def main():
    n = int(input())
    arrys = []
    for _ in range(n):
        x, y, h = map(int, input().split())
        if h != 0:
            arrys.append((x, y, h))
    for i in range(101):
        for j in range(101):
            x_tmp, y_tmp, h_tmp = arrys[0]
            H = h_tmp + abs(x_tmp - i) + abs(y_tmp - j)
            flag = 1
            for arry in arrys:
                x_t, y_t, h_t = arry
                if h_t == H - abs(x_t - i) - abs(y_t - j):
                    flag *= 1
                else:
                    flag *= 0
            if flag == 1:
                print(i, j, H)
                exit()

    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for cx in range(101):
    for cy in range(101):
        ch = -1

        for i in range(N):
            if ch == -1:
                ch = abs(cx - x[i]) + abs(cy - y[i]) + h[i]
            else:
                input_h = abs(cx - x[i]) + abs(cy - y[i]) + h[i]
                if input_h != ch:
                    ch = -2
                    break
        if ch == -2:
            continue

        for i in range(N):
            if h[i] == 0:
                if ch > (abs(cx - x[i]) + abs(cy - y[i])):
                    ch = -2
        if ch != -2:
            print(cx, cy, ch)

Submission status: Wrong Answer

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

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

for cx in range(101):
    for cy in range(101):
        ch = abs(cx - x[0]) + abs(cy - y[0]) + h[0]

        if N > 1:
            for i in range(1,N):
                input_h = abs(cx - x[i]) + abs(cy - y[i]) + h[i]
                if input_h != ch:
                    break
            else:
                print(cx, cy, ch)

        else:
            time.sleep(100)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for cx in range(101):
    for cy in range(101):
        ch = abs(cx - x[0]) + abs(cy - y[0]) + h[0]

        if N > 1:
            for i in range(1,N):
                input_h = abs(cx - x[i]) + abs(cy - y[i]) + h[i]
                if input_h != ch:
                    break
            else:
                print(cx, cy, ch)

        else:
            print(cx, cy, ch)

Submission status: Wrong Answer

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

isok = False
for cx in range(101):
    for cy in range(101):
        notok = True
        top = -1
        for h in H:
            if top==-1:
                top = h[2] + abs(cx-h[0]) + abs(cy-h[1])
            elif h[2] != max([top-abs(h[0]-cx)-abs(h[1]-cy),0]):
                notok = False
                break
        if notok:isok = True
        if isok:break
    if isok:break
        
print(cx,cy,top)

Submission status: Wrong Answer

Solution code:
def check():
    for k in range(0,n):
        if h[k]!=0:
            break
    for i in range(0,101):
        for j in range(0,101):
            flag=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(k+1,n):
                if h[l]!=max(h1-abs(i-x[l])-abs(j-y[l]),0):
                    flag=False
                    break
            if flag==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Submission status: Wrong Answer

Solution code:
def check():
    for m in range(0,n):
        if h[m]!=0:
            k=m
        if h[m]==1000000000:
            print(x[m],y[m],h[m])
            return
    for i in range(0,101):
        for j in range(0,101):
            test=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(0,n):
                if h[l]!=0:
                    if h1!=abs(i-x[l])+abs(j-y[l])+h[l]:
                        test=False
                        break
            if test==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Submission status: Wrong Answer

Solution code:
def check():
    for k in range(0,n):
        if h[k]!=0:
            break
    for i in range(0,101):
        for j in range(0,101):
            test=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(k+1,n):
                if h[l]!=0:
                    if h1!=abs(i-x[l])+abs(j-y[l])+h[l]:
                        test=False
                        break
            if test==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Submission status: Wrong Answer

Solution code:
def check():
    for m in range(0,n):
        if h[m]==1000000000:
            print(x[m],y[m],h[m])
            return
    for i in range(0,101):
        for j in range(0,101):
            test=True
            for k in range(0,n):
                if h[k]!=0:
                    h1=abs(i-x[k])+abs(j-y[k])+h[k]
                    break
            for l in range(k+1,n):
                if h1!=abs(i-x[l])+abs(j-y[l])+h[l]:
                    test=False
                    break
            if test==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Submission status: Wrong Answer

Solution code:
def check():
    for k in range(0,n):
        if h[k]==1000000000:
            print(x[k],y[k],h[k])
            return
    for i in range(0,101):
        for j in range(0,101):
            test=True
            for k in range(0,n):
                if h[k]!=0:
                    h1=abs(i-x[k])+abs(j-y[k])+h[k]
                    break
            for l in range(k+1,n):
                if h1!=abs(i-x[l])+abs(j-y[l])+h[l]:
                    test=False
                    break
            if test==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Submission status: Wrong Answer

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

for k in p :
    if(k[2] != 0) :
        tP = k
        break
for CX in range(0,101) :
    for CY in range(0,101) :
        h =  tP[2] + abs(tP[0]-CX) + abs(tP[1]-CY)
        if all(max(k==h-abs(i-CX)-abs(j-CY),0) for i,j,k in p): 
            print(CX, CY, h)
            exit()

Submission status: Wrong Answer

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

for k in p :
    if(k[2] != 0) :
        tP = k
        break
for CX in range(0,101) :
    for CY in range(0,101) :
        h =  tP[2] + abs(tP[0]-CX) + abs(tP[1]-CY)
        if all(k==h-abs(i-CX)-abs(j-CY) for i,j,k in p): 
            print(CX, CY, h)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for _ in range(N):
    x, y, h = list(map(int, input().split()))
    data.append([x,y,h])
for x in range(101):
    for y in range(101):
        result = 0
        for dat in data:
            if dat[2] != 0:
                result = abs(dat[0] - x) + abs(dat[1] - y) + dat[2]
                break
        flag = True
        for dat in data:
            if result != abs(dat[0] - x) + abs(dat[1] - y) + dat[2] and dat[2] != 0:
                flag = False
                break
        if flag == True:print(x,y,result)

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for _ in range(N):
    x, y, h = list(map(int, input().split()))
    data.append([x,y,h])
for x in range(101):
    flag2 = True
    for y in range(101):
        result = abs(data[0][0] - x) + abs(data[0][1] - y) + data[0][2]
        flag = True
        for dat in data:
            if result != abs(dat[0] - x) + abs(dat[1] - y) + dat[2]:
                flag = False
                break
        if flag == True:
            print(x,y,result)
            Flag2 = False
            break
    if flag2 == False:break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    xs = list()
    ys = list()
    hs = list()

    # See:
    # https://beta.atcoder.jp/contests/abc112/submissions/3360331
    # https://img.atcoder.jp/abc112/editorial.pdf
    # https://www.youtube.com/watch?v=CURWJ1Dr44A
    for i in range(n):
        xi, yi, hi = map(int, input().split())
        xs.append(xi)
        ys.append(yi)
        hs.append(hi)

        if hi >= 1:
            pos = i

    for cx in range(100 + 1):
        for cy in range(100 + 1):
            is_consistent = True
            candidate_height = abs(xs[pos] - cx) + abs(ys[pos] - cy) + hs[pos]

            for i in range(n):
                each_height = max(abs(xs[i] - cx) + abs(ys[i] - cy) + hs[i], 0)

                if candidate_height != each_height:
                    global is_consistent
                    is_consistent = False
                    break

            if is_consistent:
                print(cx, cy, candidate_height)
                exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    xs = list()
    ys = list()
    hs = list()

    # See:
    # https://beta.atcoder.jp/contests/abc112/submissions/3360331
    # https://img.atcoder.jp/abc112/editorial.pdf
    # https://www.youtube.com/watch?v=CURWJ1Dr44A
    for i in range(n):
        xi, yi, hi = map(int, input().split())
        xs.append(xi)
        ys.append(yi)
        hs.append(hi)

        if hi >= 1:
            pos = i

    is_consistent = True

    for cx in range(100 + 1):
        for cy in range(100 + 1):
            is_consistent = True
            candidate_height = abs(xs[pos] - cx) + abs(ys[pos] - cy) + hs[pos]

            for i in range(n):
                each_height = max(abs(xs[i] - cx) + abs(ys[i] - cy) + hs[i], 0)

                if candidate_height != each_height:
                    is_consistent = False
                    break

            if is_consistent:
                print(cx, cy, candidate_height)
                exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
data = []
for _ in range(N):
    x, y, h = list(map(int, input().split()))
    data.append([x,y,h])
for x in range(101):
    for y in range(101):
        result = abs(data[0][0] - x) + abs(data[0][1] - y) + data[0][2]
        flag = True
        for dat in data:
            if result != abs(dat[0] - x) + abs(dat[1] - y) + dat[2]:
                flag = False
                break
        if flag == True:print(x,y,result)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    xs = list()
    ys = list()
    hs = list()

    # See:
    # https://beta.atcoder.jp/contests/abc112/submissions/3360331
    # https://img.atcoder.jp/abc112/editorial.pdf
    # https://www.youtube.com/watch?v=CURWJ1Dr44A
    for i in range(n):
        xi, yi, hi = map(int, input().split())
        xs.append(xi)
        ys.append(yi)
        hs.append(hi)

        if hi >= 1:
            pos = i

    for cx in range(100 + 1):
        for cy in range(100 + 1):
            is_consistent = True
            candidate_height = abs(xs[pos] - cx) + abs(ys[pos] - cy) + hs[pos]

            for i in range(n):
                each_height = max(abs(xs[i] - cx) + abs(ys[i] - cy) + hs[i], 0)

                if candidate_height != each_height:
                    is_consistent = False
                    break

            if is_consistent:
                print(cx, cy, candidate_height)
                exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
x = []
y = []
h = []
for i in range(N):
    _x, _y, _h = map(int, input().split())
    x.append(_x)
    y.append(_y)
    h.append(_h)

def solve():
    for cx in range(101):
        for cy in range(101):
            H = -1
            Hmax = 114514
            flg = True
            for i in range(N):
                dist = abs(x[i] - cx) + abs(y[i] - cy)
                if h[i] > 0:
                    HH = h[i] + dist
                    if H < 0:
                        H = HH
                    if H != HH or H > Hmax:
                        flg = False
                        break
                else:
                    Hmax = min(Hmax, dist)
                    if H > Hmax or Hmax == 0:
                        flg = False
                        break
            if flg:
                if Hmax == 1:
                    H = 1
                print(cx, cy, H)
                return

solve()