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())
xyh = [list(map(int, input().split())) for _ in range(N)]

for x in range(101):
    for y in range(101):
        chpre = -1
        for i, d in enumerate(xyh):
            if d[2] == 0:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if chpre == -1:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break

print(' '.join([str(a) for a in ans]))

Submission status: Wrong Answer

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

ans = []
c = 0
for x in range(101):
    for y in range(101):
        chpre = -1
        for i, d in enumerate(xyh):
            if d[2] == 0 and chpre != -1:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if chpre == -1:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break

print(' '.join([str(a) for a in ans]))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
checked = [[False for _ in range(101)] for _ in range(101)]

xyh.sort(key=itemgetter(2), reverse=True)

q = [xyh[0]]
ans = []
c = 0
for x in range(101):
    for y in range(101):
        for i, d in enumerate(xyh):
            if d[2] == 0:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if i == 0:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break

print(' '.join([str(a) for a in ans]))

Submission status: Wrong Answer

Solution code:
n,*xyh=map(int,open(0).read().split())
x=xyh[0::3]
y=xyh[1::3]
h=xyh[2::3]

for cx in range(101):
    for cy in range(101):
        H = abs(cx-x[0])+abs(cy-y[0])+h[0]
        for i in range(1,n):
            if max(H-abs(cx-x[i])-abs(cy-y[i]),0) == h[i]:
                if i == n-1:
                    print(cx,cy,H)
                    exit()
                else:
                    continue
            else:
                break

Submission status: Wrong Answer

Solution code:
n,*xyh=map(int,open(0).read().split())
x=xyh[0::3]
y=xyh[1::3]
h=xyh[2::3]
if max(h)==100:
    print(x[h.index(100)],y[h.index(100)],100)
else:
    for cx in range(101):
        for cy in range(101):
            H = abs(cx-x[0])+abs(cy-y[0])+h[0]
            for i in range(1,n):
                if H == abs(cx-x[i])+abs(cy-y[i])+h[i]:
                    if i == n-1:
                        print(cx,cy,H)
                        exit()
                    else:
                        continue
                else:
                    break

Submission status: Wrong Answer

Solution code:
n,*xyh=map(int,open(0).read().split())
x=xyh[0::3]
y=xyh[1::3]
h=xyh[2::3]
for cx in range(101):
    for cy in range(101):
        H = abs(cx-x[0])+abs(cy-y[0])+h[0]
        for i in range(1,n):
            if H == abs(cx-x[i])+abs(cy-y[i])+h[i]:
                if i == n-1:
                    print(cx,cy,H)
                    exit()
                else:
                    continue
            else:
                break

Submission status: Wrong Answer

Solution code:
def solve():
    cands = []
    for cx in range(100 + 1):
        for cy in range(100 + 1):
            is_center = True
            temp_h = -1
            for x, y, h in m:
                if h != 0:
                    calc_h = h + abs(cx - x) + abs(cy - y)
                    if temp_h == -1:
                        temp_h = calc_h
                    else:
                        if temp_h != calc_h:
                            is_center = False
                            break
            if is_center:
                cands.append((cx, cy, temp_h))

    for cx, cy, temp_h in cands:
        is_answer = True
        for x, y, h in m:
            if h == 0:
                if temp_h - abs(cx - x) - abs(cy - y) != 0:
                    is_answer = False
                    break
        if is_answer:
            return cx, cy, temp_h

    return -1, -1, -1


n = int(input())
m = tuple(tuple(map(int, input().split())) for _ in range(n))
print(*solve())

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])

def hight(inp):
    cx,cy,x,y,h=inp
    if h==0:
        return -1
    else:
        return abs(x-cx)+abs(y-cy)+h
    
for cx in range(101):
    for cy in range(101):
        H=set()
        for i in range(n):
            h=hight([cx,cy]+a[i])
            if h!=-1:
                H.add(h)
        if len(H)==1:
            for i in H:
                d=i
            ans=cx,cy,d
print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
p = [[] for i in range(N)]

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
xyhl = [list(map(int, input().split())) for _ in range(n)]
xyhl = [xyh for xyh in xyhl if xyh[2] != 0]

tmaps = np.zeros((101, 101, len(xyhl)), dtype="int64")
for d in range(len(xyhl)) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl[d]
            tmaps[i, j, d] = abs(x-i)+abs(y-j)+h

dmaps = np.diff(tmaps, axis=2)
xmap = np.logical_or.reduce(dmaps, axis=2)
place = np.where(np.logical_not(xmap))
cx, cy = place[0][0], place[1][0]
h = tmaps[cx, cy, 0]
print("{} {} {}".format(cx, cy, h))

Submission status: Wrong Answer

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

for CX in range(101):
    for CY in range(101):
        Harr=[]
        for i in range(N):
            x=cood[i][0]
            y=cood[i][1]
            h=cood[i][2]
            if h>0:
                canH=h+abs(x-CX)+abs(y-CY)
                if canH>=1:
                    Harr.append(canH)
        if len(set(Harr))==1:
            print(CX,CY,canH)
            break
        elif len(set(Harr))==0:
            print(CX,CY,1)
            break
        else:
            continue
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]

for px in range(101):
    for py in range(101):
        ph = h + abs(px - x) + abs(py - y) #適当な情報一つとpx,pyでpyを決め打ち
        ok = True
        for x, y, h in xyh:
            if h > 0 and ph - h != abs(px - x) + abs(py - y): #その情報において式が成り立たない
                ok = False
            if h == 0 and ph > abs(px - x) + abs(py - y):     
                ok = False

        if ok:
            print(str(px) + " " + str(py) + " " + str(ph))

Submission status: Wrong Answer

Solution code:
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]

for px in range(101):
    for py in range(101):
        ph = h + abs(px - x) + abs(py - y) #適当な情報一つとpx,pyでpyを決め打ち
        ok = True
        for x, y, h in xyh:
#            if h > 0 and ph - h != abs(px - x) + abs(py - y): #その情報において式が成り立たない
#                ok = False
#            if h == 0 and ph > abs(px - x) + abs(py - y):     
#                ok = False
            if ph != h + abs(px - x) + abs(py - y):
                ok = False 
        if ok:
            print(str(px) + " " + str(py) + " " + str(ph))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=itemgetter(2))
Cx = []
Cy = []
H = xyh[-1][2]
memox = xyh[0][0]
memoy = xyh[0][1]
memoh = xyh[0][2]
def aH(x,y):
    return str(max(memoh + abs(x - memox) + abs(y - memoy),0))

for i in range(N-1,-1,-1):
    if xyh[i][2] == H:
        Cx.append(xyh[i][0])
        Cy.append(xyh[i][1])
        xyh.pop(i)
Cx = set(Cx)
Cy = set(Cy)
ax = ""
ay = ""
if len(Cx) > 1:
    if sum(Cx) / len(Cx) == int(sum(Cx) / len(Cx)):
        ax = str(sum(Cx)//len(Cx))
        ay = str(sum(Cy)//len(Cy))
        print(ax + " " + ay + " " + aH(int(ax), int(ay)))
    else:
        xs = [x for x, y, h in xyh]
        ys = [y for x, y, h in xyh]
        for cx in Cx:
            if not cx in xs:
                ax = str(cx)
                break
        for cy in Cy:
            if not cy in ys:
                ay = str(cy)
                break
        print(ax + " " + ay + " " + aH(int(ax), int(ay)))
else:
    print(str(list(Cx)[0]) + " " + str(list(Cy)[0]) + " " + str(H))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=itemgetter(2))
Cx = []
Cy = []
H = xyh[-1][2]
memox = xyh[0][0]
memoy = xyh[0][1]
memoh = xyh[0][2]
def aH(x,y):
    return str(max(memoh + abs(x - memox) + abs(y - memoy),0))

for i in range(N-1,-1,-1):
    if xyh[i][2] == H:
        Cx.append(xyh[i][0])
        Cy.append(xyh[i][1])
        xyh.pop(i)
set(Cx)
set(Cy)
ax = ""
ay = ""
if len(Cx) > 1:
    if sum(Cx) / len(Cx) == int(sum(Cx) // len(Cx)):
        ax = str(sum(Cx)//len(Cx))
        ay = str(sum(Cy)//len(Cy))
        print(ax + " " + ay + " " + aH(int(ax), int(ay)))
    else:
        xs = [x for x, y, h in xyh]
        ys = [y for x, y, h in xyh]
        for cx in Cx:
            if not cx in xs:
                ax = str(cx)
                break
        for cy in Cy:
            if not cy in ys:
                ay = str(cy)
                break
        print(ax + " " + ay + " " + aH(int(ax), int(ay)))
else:
    print(str(Cx[0]) + " " + str(Cy[0]) + " " + str(H))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh.sort(key=itemgetter(2))
Cx = []
Cy = []
H = xyh[-1][2]
for i in range(N-1,-1,-1):
    if xyh[-i][2] == H:
        Cx.append(xyh[-i][0])
        Cy.append(xyh[-i][1])
        xyh.pop(-i)
if len(Cx) > 1:
    if len(set(Cx))%2==1:
        print(str(sum(Cx)//len(Cx))+" "+str(sum(Cy)//len(Cy))+" "+ str(H+1))
    else:
        xs = [x for x,y,h in xyh]
        ys = [y for x,y,h in xyh]
        for cx in Cx:
            if not cx in xs:
                print(cx, end=" ")
        for cy in Cy:
            if not cy in ys:
                print(cy,end = " ")
        print(H+1)
else:
    print(str(Cx[0]) + " " + str(Cy[0]) + " " + str(H))

Submission status: Wrong Answer

Solution code:
def height(x, y ,h, Cx, Cy):
    return h + abs(x - Cx) + abs(y - Cy)


N = int(input())
lst_xyh = [tuple(map(int, input().split())) for _ in range(N)]
for Cx in range(101):
    for Cy in range(101):
        H = height(lst_xyh[0][0], lst_xyh[0][1], lst_xyh[0][2], Cx, Cy)
        for i in range(1, N):
            x = lst_xyh[i][0]
            y = lst_xyh[i][1]
            h = lst_xyh[i][2]
            tmp = height(x, y, h, Cx, Cy)
            if tmp != H:
                break
        else:
            print(Cx, Cy, H)
            exit()

Submission status: Wrong Answer

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

for CX in range(101):
    for CY in range(101):
        Harr=[]
        for i in range(N):
            x=cood[i][0]
            y=cood[i][1]
            h=cood[i][2]
            if h>0:
                canH=h+abs(x-CX)+abs(y-CY)
                if canH>=1:
                    Harr.append(canH)
        if len(set(Harr))==1:
            print(CX,CY,canH)
            break
        else:
            continue
        break

Submission status: Wrong Answer

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

ans = [0, 0, 0]
for X in range(101):
    for Y in range(101):
        H = [0] * N
        count = 0
        height = 0
        for x, y, h in XYH:
            if h == 0:
                continue
            else:
                height = h + abs(X - x) + abs(Y - y)
                H[count] = height
                count += 1
        if H.count(height) == count:
            ans = (str(X), str(Y), str(height))

print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())

info = sorted(info, key=lambda x: x[2], reverse=True)

height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        height[x_kouho][y_kouho] = info[0][2] + \
            abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != max(0, (info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho))):
                break
            if p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    print("{} {} {}".format(
                        x_kouho, y_kouho, height[x_kouho][y_kouho]))
                    exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())

info = sorted(info, key=lambda x: x[2], reverse=True)

height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        height[x_kouho][y_kouho] = info[0][2] + \
            abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != max(0,(info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho))):
                break
            if p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())

info = sorted(info, key=lambda x: x[2], reverse=True)

height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        height[x_kouho][y_kouho] = info[0][2] + \
            abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != max(0,(info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho))):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())

info = sorted(info, key=lambda x: x[2], reverse=True)

height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        height[x_kouho][y_kouho] = info[0][2] + \
            abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        for kari in range(N):
            if info[kari][2] == 0:
                continue
            else:
                height[x_kouho][y_kouho] = info[kari][2] + \
                    abs(info[kari][0] - x_kouho) + abs(info[kari][1] - y_kouho)
                break
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        for kari in range(N):
            if info[kari][2] == 0:
                continue
            else:
                height[x_kouho][y_kouho] = info[kari][2] + \
                    abs(info[kari][0] - x_kouho) + abs(info[kari][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        for kari in range(N):
            if info[kari][2] == 0:
                continue
            else:
                height[x_kouho][y_kouho] = info[0][2] + \
                    abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        for kari in range(N):
            if info[kari][2] + abs(info[kari][0] - x_kouho) + abs(info[kari][1] - y_kouho) == 0:
                continue
            else:
                height[x_kouho][y_kouho] = info[0][2] + \
                    abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        for kari in range(N):
            if info[0][2] + abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho) == 0:
                continue
            else:
                height[x_kouho][y_kouho] = info[0][2] + \
                    abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N = int(input())
info = [0] * N
ans = [0]*3
for i in range(N):
    info[i] = [0] * 3
    info[i][0], info[i][1], info[i][2] = map(int, input().split())
height = [0] * 101
for x_kouho in range(101):
    height[x_kouho] = [0]*101
    for y_kouho in range(101):
        height[x_kouho][y_kouho] = info[0][2] + \
            abs(info[0][0] - x_kouho) + abs(info[0][1] - y_kouho)
        for p in range(1, N):
            if height[x_kouho][y_kouho] != info[p][2] + abs(info[p][0] - x_kouho) + abs(info[p][1] - y_kouho):
                break
            elif p == N - 1:
                if 0 <= height[x_kouho][y_kouho]:
                    ans[0], ans[1], ans[2] = x_kouho, y_kouho, height[x_kouho][y_kouho]
print("{} {} {}".format(ans[0], ans[1], ans[2]))

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[]
H=0
flag=0
for i in range(N):
    a,b,c=map(int,input().split())
    A.append([a,b,c])

for x in range(0,101):
    for y in range(0,101):
        H=A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        flag=0
        for n in range(1,N):
            if H != A[n][2] + abs(A[n][0] - x) + abs(A[n][1] - y):
                flag=1
        if flag==0:
            print(str(x)+" "+str(y)+" "+str(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())

H = max(h)
while 1:
  for i in range(101):
    for j in range(101):
      for k in range(n):
        dx,dy = abs(x[k]-i),abs(x[k]-j)
        if max(H-dx-dy,0)!=h[k]:
          break
      print(i,j,H)
      exit()
  H +=1

Submission status: Wrong Answer

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

for i in range(101):
    for j in range(101):
        cx, cy = i, j
        h_list = []
        for k in range(n):
            x, y, h = pir[k]
            if h != 0:
                h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) > 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Submission status: Wrong Answer

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

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(n):
            x, y, h = pir[k]
            if h != 0:
                h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) > 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Submission status: Wrong Answer

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

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(n):
            x, y, h = pir[k]
            if h != 0:
                h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) != 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Submission status: Wrong Answer

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

for i in range(101):
    for j in range(101):
        cx, cy = (i, j)
        h_list = []
        for k in range(n):
            x, y, h = pir[k]
            h_list.append(h + abs(x - cx) + abs(y - cy))
        if len(set(h_list)) != 1:
            continue
        else:
            print(cx, cy, h_list[0])
            exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [tuple(map(int,input().split())) for _ in range(n)]
for _ in range(n):
  if a[_][2] > 1:
    flag = _
    break
  if _ == n-1:
    for i in range(101):
      for j in range(101):
        for k in range(n):
          if a[k][0] == i and a[k][1] == j:
            break
          if k == n-1:
            print(i,j,1)
            sys.exit()
c = 0
for _ in range(101): #x
  for i in range(101): #y
    h = a[flag][2] + abs(a[flag][0]-_) + abs(a[flag][1]-i)
    for j in range(n):
      b = 0
      if a[j][2] != max(h - abs(a[j][0]-_) - abs(a[j][1]-i),0):
        b = 1
        break
      if j == n-1:
        print(_,i,h)
        c = 1
        break
    if c == 1:
      break
  if c == 1:
    break

Submission status: Wrong Answer

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

for Cx in range(101):
    for Cy in range(101):
        H = 0
        flag = 1
        for i in range(N):
            x, y, h = table[i]
            if h == 0:
                continue
            elif H == 0:
                H = h + abs(x-Cx) + abs(y-Cy)
            elif H != h + abs(x-Cx) + abs(y-Cy):
                flag = 0

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

Submission status: Wrong Answer

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

for Cx in range(1, 100):
    for Cy in range(1, 100):
        H = 0
        flag = 1
        for i in range(1, N):
            x, y, h = table[i]
            if h == 0:
                continue
            elif H == 0:
                H = h + abs(x-Cx) + abs(y-Cy)
            elif H != h + abs(x-Cx) + abs(y-Cy):
                flag = 0
                
        if flag:
            print(Cx,Cy,H)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [tuple(map(int,input().split())) for _ in range(n)]
for _ in range(n):
  if a[_][2] > 1:
    flag = _
    break
  if _ == n-1:
    print(a[_][0],a[_][1],a[_][2])
    sys.exit()
c = 0
for _ in range(101): #x
  for i in range(101): #y
    h = a[flag][2] + abs(a[flag][0]-_) + abs(a[flag][1]-i)
    for j in range(n):
      b = 0
      if a[j][2] != max(h - abs(a[j][0]-_) - abs(a[j][1]-i),0):
        b = 1
        break
      if j == n-1:
        print(_,i,h)
        c = 1
        break
    if c == 1:
      break
  if c == 1:
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        #for i in range(n):
        #    if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
        #        good = False
        #        break
        #if good:
    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)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
  for cy in range(101):
    good = True
    h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
    for i in range(n):
      if h != xyh[i][2]+abs(cx-xyh[i][0])+abs(cy-xyh[i][1]):
        good = False
        break
    if good:
      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)]
for cx in range(101):
  for cy in range(101):
    good = True
    h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
    for i in range(n):
      if h>10**9 or h != xyh[i][2]+abs(cx-xyh[i][0])+abs(cy-xyh[i][1]):
        good = False
        break
    if good:
      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)]
for cx in range(101):
  for cy in range(101):
    good = True
    h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
    for i in range(n):
      if h != xyh[i][2]+abs(cx-xyh[i][0])+abs(cy-xyh[i][1]):
        good = False
        break
    if good:
      print(cx, cy, 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] > 0 :
                if H == 0 :
                    H = abs(para[i][0]-c_x) + abs(para[i][1]-c_y)+para[i][2]
                    continue
                if para[i][2] == H - abs(para[i][0]-c_x) - abs(para[i][1]-c_y) :
                    continue

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