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):
n = int(input())
x = []
y = []
h = []
for i in range(n):
  xyh = [int(x) for x in input().split()]
  x.append(xyh[0])
  y.append(xyh[1])
  h.append(xyh[2])
maxx = x[h.index(max(h))]
maxy = y[h.index(max(h))]
maxh = max(h)
i=0
while i<len(h):
  j=i+1
  while j<len(h):
    if h[i]==h[j]:
      if y[i]==y[j]:
        maxy = (y[i]+y[j])/2
        maxh = y[i]+(j-i)/2
      if x[i]==x[j]:
        maxx = (x[i]+x[j])/2
        maxh = y[i]+(j-i)/2
    j+=1
  i+=1
print(str(maxx)+ ' ' + str(maxy) + ' ' + str(max(h)))

n = int(input())
x = []
y = []
h = []
for i in range(n):
  xyh = [int(x) for x in input().split()]
  x.append(xyh[0])
  y.append(xyh[1])
  h.append(xyh[2])
print(str(x[h.index(max(h))]) + ' ' + str(y[h.index(max(h))]) + ' ' + str(max(h)))

n = int(input())
points = []
center = True
centercount = 0
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  iterator = 0
  while iterator<len(points):
    if points[iterator][2]!=0:
      points[iterator], points[0] = points[0], points[iterator]
      break
    iterator+=1
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if temph != abs(points[k][0]-i)+abs(points[k][1]-j)+points[k][2]:
          if points[k][2]==0:
            k+=1
            continue
          center = False
          break
        k+=1
      if center==True and temph>0:
        cx = i
        cy = j
        h = temph
        centercount+=1
        break
  if centercount==101:
    print(str(cx) + ' ' + str(cy) + ' ' + str(h))



n = int(input())
points = []
center = True
for i in range(n):
  points.append([int(x) for x in input().split()])
if n==1:
  print(str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2]))
else:
  iterator = 0
  while iterator<len(points):
    if points[iterator][2]!=0:
      points[iterator], points[0] = points[0], points[iterator]
      break
    iterator+=1
  for i in range(0, 101):
    for j in range(0, 101):
      center = True
      temph = abs(points[0][0]-i)+abs(points[0][1]-j)+points[0][2]
      k = 1
      while k<len(points):
        if points[k][2]!=max(0, temph-abs(points[k][0]-i)-abs(points[k][1]-j)):
          center = False
          break
        k+=1
      if center==True:
        cx = i
        cy = j
        h = temph
        break
  print(str(cx) + ' ' + str(cy) + ' ' + str(h))



Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted