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:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getSomeInputListInt(n)

rng = 101

def clc(i, j, h, x, y):
    return max(0, h + abs(i-x) + abs(j-y))

ansi = 0
ansj = 0
flgI = False

for i in range(rng):
    for j in range(rng):
        flg = True
        for k in range(n-1):
            tmpBefore = clc(i, j, data[k][2], data[k][0], data[k][1])
            tmpAfter = clc(i, j, data[k+1][2], data[k+1][0], data[k+1][1])
            if tmpBefore != tmpAfter or tmpBefore < 1:
                flg = False
                break

        if flg:
            ansi = i
            ansj = j
            flgI = True
            break

    if flgI:
        break

print(ansi, ansj, tmpAfter)

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getSomeInputListInt(n)

rng = 101

def clc(i, j, h, x, y):
    return max(0, h + abs(i-x) + abs(j-y))

ansi = 0
ansj = 0
flgI = False

for i in range(rng):
    for j in range(rng):
        flg = True
        for k in range(n-1):
            tmpBefore = clc(i, j, data[k][2], data[k][0], data[k][1])
            tmpAfter = clc(i, j, data[k+1][2], data[k+1][0], data[k+1][1])
            if tmpBefore != tmpAfter:
                flg = False
                break

        if flg:
            ansi = i
            ansj = j
            flgI = True
            break

    if flgI:
        break

print(ansi, ansj, tmpAfter)

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getSomeInputListInt(n)

rng = 101

def clc(i, j, h, x, y):
    return max(0, h + abs(i-x) + abs(j-y))

ansi = 0
ansj = 0

for i in range(rng):
    flgI = False
    for j in range(rng):
        flgJ = False
        for k in range(n-1):
            tmpBefore = clc(i, j, data[k][2], data[k][0], data[k][1])
            tmpAfter = clc(i, j, data[k+1][2], data[k+1][0], data[k+1][1])
            if tmpBefore != tmpAfter:
                flgJ = True
                break

        if not flgJ:
            ansi = i
            ansj = j
            flgI = True
            break
    if flgI:
        break

print(ansi, ansj, clc(ansi, ansj, data[0][2], data[0][0], data[0][1]))

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getSomeInputListInt(n)

rng = 101

def clc(i, j, h, x, y):
    return max(0, h + abs(i-x) + abs(j-y))

ansi = 0
ansj = 0

for i in range(rng):
    flgI = False
    for j in range(rng):
        flgJ = False
        for k in range(n-1):
            tmpBefore = clc(i, j, data[k][2], data[k][0], data[k][1])
            tmpAfter = clc(i, j, data[k+1][2], data[k+1][0], data[k+1][1])
            if tmpBefore != tmpAfter:
                flgJ = True
                break

        if flgJ:
            break

        if not flgJ:
            ansi = i
            ansj = j
            flgI == True
            break

    if flgI:
        break

print(ansi, ansj, clc(ansi, ansj, data[0][2], data[0][0], data[0][1]))

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
data = getSomeInputListInt(n)

rng = 101

def clc(i, j, h, x, y):
    return h+abs(i-x)+abs(j-y)

ansi = 0
ansj = 0

for i in range(rng):
    flgI = False
    for j in range(rng):
        flgJ = False
        for k in range(n-1):
            tmpBefore = clc(i, j, data[k][2], data[k][0], data[k][1])
            tmpAfter = clc(i, j, data[k+1][2], data[k+1][0], data[k+1][1])
            if tmpBefore != tmpAfter:
                flgJ = True
                break

        if not flgJ:
            ansi = i
            ansj = j
            flgI == True
            break

    if flgI:
        break

print(ansi, ansj, clc(ansi, ansj, data[0][2], data[0][0], data[0][1]))

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info =[]
    info0 = []
    for _ in range(N):
        x,y,h = LMIIS()
        if h == 0:
            info0.append((x,y,h))
        else:
            info.append((x,y,h))
    if len(info) + len(info0) < N:
        raise

    # init candidates
    x,y,h = info[0]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)



    # check
    for x,y,h in info0:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] > vtop(x,j,y,i,h):
                    b[i][j] = 0
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] != vtop(x,j,y,i,h):
                    b[i][j] = 0



    # answer
    ansl = []
    if N == 1:
        x,y,h = (info + info0)[0]
        print(x,y,h)
        return
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info + info0:
            if h1 != max(h0-abs(x0-x1)-abs(y0-y1),0):
                f = False
                break
        if f:
            print(x0,y0,h0)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info =[]
    info0 = []
    for _ in range(N):
        x,y,h = LMIIS()
        if h == 0:
            info0.append((x,y,h))
        else:
            info.append((x,y,h))
    if len(info) + len(info0) < N:
        raise

    # init candidates
    x,y,h = info[0]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)



    # check
    for x,y,h in info0:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] > vtop(x,j,y,i,h):
                    b[i][j] = 0
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] != vtop(x,j,y,i,h):
                    b[i][j] = 0



    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info + info0:
            if h1 != max(h0-abs(x0-x1)-abs(y0-y1),0):
                f = False
                break
        if f:
            print(x0,y0,h0)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info =[]
    info0 = []
    for _ in range(N):
        x,y,h = LMIIS()
        if h == 0:
            info0.append((x,y,h))
        else:
            info.append((x,y,h))

    # init candidates
    x,y,h = info[0]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)



    # check
    for x,y,h in info0:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] > vtop(x,j,y,i,h):
                    b[i][j] = 0
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] != vtop(x,j,y,i,h):
                    b[i][j] = 0



    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info + info0:
            if h1 != max(h0-abs(x0-x1)-abs(y0-y1),0):
                f = False
                break
        if f:
            print(x0,y0,h0)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info =[]
    info0 = []
    for _ in range(N):
        x,y,h = LMIIS()
        if h == 0:
            info0.append((x,y,h))
        else:
            info.append((x,y,h))

    # init candidates
    x,y,h = info[0]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)



    # check
    for x,y,h in info0:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] > vtop(x,j,y,i,h):
                    b[i][j] = 0
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] != vtop(x,j,y,i,h):
                    b[i][j] = 0



    # answer
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info =[]
    info0 = []
    for _ in range(N):
        x,y,h = LMIIS()
        if h == 0:
            info0.append((x,y,h))
        else:
            info.append((x,y,h))

    # init candidates
    x,y,h = info[0]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)



    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] != vtop(x,j,y,i,h):
                    b[i][j] = 0
    for x,y,h in info0:
        for i in range(MAXL):
            for j in range(MAXL):
                if b[i][j] > vtop(x,j,y,i,h):
                    b[i][j] = 0



    # answer
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 

    # init candidates
    for x,y,h in info:
        if h != 0:
            for i in range(MAXL):
                for j in range(MAXL):
                    b[i][j] = vtop(x,j,y,i,h)
        break


    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 

    # init candidates
    for x,y,h in info:
        if h != 0:
            for i in range(MAXL):
                for j in range(MAXL):
                    b[i][j] = vtop(x,j,y,i,h)


    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 

    # init candidates
    for x,y,h in info:
        if h != 0:
            for i in range(MAXL):
                for j in range(MAXL):
                    b[i][j] = vtop(x,j,y,i,h)
        break

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 

    # init candidates
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])

            return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    MAXL = 101
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    N = II()
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 


    # init candidates
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
                break
        if f:
            print(x0,y0,h0)
            return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
 
    N = II()
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]
 
    
    # get info
    info = [LMIIS() for _ in range(N)]
    if len(info) < N :
        raise 
    print(0,0,0)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
 
    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]
 
    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0
 
    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i

    # init candidates
    for x,y,h in info:
        if h != 0:
            for i in range(MAXL):
                for j in range(MAXL):
                    b[i][j] = vtop(x,j,y,i,h)
        break

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
    #             ansl.append((j,i,b[i][j]))
    
    # ansl2 = []
    # for x0,y0,h0 in ansl:
    #     f = True
    #     for x1,y1,h1 in info:
            
    #         if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
    #             f = False
    #             break
    #     if f:
    #         ansl2.append((x0,y0,h0))
    # x,y,h= ansl2[-1]
    # print(x,y,h)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
                break
        if f:
            print(x0,y0,h0)
            return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    b[x][y] = 0
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
        if f:
            print(x0,y0,h0)
            return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
            for j in range(MAXL):
                b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = -1

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = -1

    # answer
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                print(j,i,b[i][j])
                return


if __name__ == '__main__':
    main()