Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
"""
Created on Sat Oct  6 17:56:47 2018
ABC112C
@author: maezawa
"""
import itertools as itr
n = int(input())
xyh = []
for i in range(n):
    xyhi = list(map(int, input().split()))
    xyh.append(xyhi)
xyh.sort(key=lambda x:x[2], reverse=True)
print(xyh)

for cx, cy in itr.product(range(101),range(101)):
    hres = abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
    ok = 0
    for i in range(1,n):
        if xyh[i][2] > 0:
            htemp = abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)+xyh[i][2]
            #print(cx, cy, i, hh)
            if  htemp != hres:
                ok = -1
                break    
        else:
            if abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy) < hres:
                ok = -1
                break
    if ok == 0:
        print(cx, cy, hres)
        break


# -*- coding: utf-8 -*-
"""
Created on Sat Oct  6 17:56:47 2018
ABC112C
@author: maezawa
"""
import itertools as itr
n = int(input())
xyh = []
for i in range(n):
    xyhi = list(map(int, input().split()))
    xyh.append(xyhi)
xyh.sort(key=lambda x:x[2], reverse=True)
print(xyh)

for cx, cy in itr.product(range(101),range(101)):
    hres = abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
    ok = 0
    for i in range(1,n):
        if xyh[i][2] > 0:
            htemp = abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)+xyh[i][2]
            #print(cx, cy, i, hh)
            if  htemp != hres:
                ok = -1
                break    
        else:
            if abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy) <= hres:
                ok = -1
                break
    if ok == 0:
        break
print(cx, cy, hres)

# -*- coding: utf-8 -*-
"""
Created on Sat Oct  6 17:56:47 2018
ABC112C
@author: maezawa
"""
import itertools as itr
n = int(input())
xyh = []
for i in range(n):
    xyhi = list(map(int, input().split()))
    xyh.append(xyhi)
xyh.sort(key=lambda x:x[2], reverse=True)


for cx, cy in itr.product(range(101),range(101)):
    hres = abs(xyh[0][0]-cx)+abs(xyh[0][1]-cy)+xyh[0][2]
    ok = 0
    for i in range(1,n):
        if xyh[i][2] > 0:
            htemp = abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy)+xyh[i][2]
            #print(cx, cy, i, hh)
            if  htemp != hres:
                ok = -1
                break    
        else:
            if abs(xyh[i][0]-cx)+abs(xyh[i][1]-cy) < hres:
                ok = -1
                break
    if ok == 0:
        print(cx, cy, hres)
        break


Verdicts: Wrong Answer

Wrong Answer

Accepted