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):
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * (1 + 1) for _ in range(1 + 1)]
    for info in infos:
        field[info[1]][info[0]] = True
    
    for y in range(1 + 1):
        for x in range(1 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(1 + 1):
    for cx in range(1 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]

if N == 1:
    print(infos[2])


if sum([x[2] for x in infos]) == 0:
    field = [[False] * (100 + 1) for _ in range(100 + 1)]
    for info in infos:
        field[info[1]][info[0]] = True
    
    for y in range(100 + 1):
        for x in range(100 + 1):
            if field[y][x] == False:
                print(x, y, 1)
                sys.exit()

 
for cy in range(1 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            if info[2] != 0:
                pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
     
                if pseudo_h1 != pseudo_h2:
                    flag_assumpt = False
                    break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]
infos = sorted(infos, key=lambda x: x[2])[::-1]

if N == 1:
    print(infos[0][0], infos[0][1], infos[0][2])
    sys.exit()

for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
            
            if info[2] == 0:
                if abs(info[0] - cx) + abs(info[1] - cy) < pseudo_h1:
                    flag_assumpt = False
                    break
                
            elif pseudo_h1 != pseudo_h2:
                flag_assumpt = False
                break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Verdicts: Wrong Answer

Wrong Answer

Accepted