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

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)


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):
            h = abs(x - cx) + abs(y - cy) + h
            if ch != h:
                ok = False
            if not ok:
                break
        if ok:
            ans = cx, cy, ch

print(*ans)


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)


import itertools
import os
import sys

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

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


idx = np.where(H > 0)[0][0]


for x, y in itertools.product(range(101), range(101)):
    height = H[idx] + abs(X[idx] - x) + abs(Y[idx] - y)
    ok = np.all(np.maximum(0, height - (np.abs(X - x) + np.abs(Y - y))) == H)
    if ok:
        print(x, y, height)
        exit()


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted