Problem:

Official House

You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.

  For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that &minus;v persons left.

Assume that initially no person lives in the building. 

Input

  In the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line. 

Output

For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings.

Constraints

No incorrect building, floor and room numbers are given.

0 ≤ the number of tenants during the management ≤ 9

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0



Sample input:
3
1 1 3 8
3 2 2 7
4 3 8 1


Sample output:
 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

a = {}
b = {}
c = {}
d = {}

for i in range(1, 31):
    a[i] = 0
    b[i] = 0
    c[i] = 0
    d[i] = 0

n = int(input())

for j in range(n):
    m = list(map(int, input().split()))

    if m[0] == 1:
        a[m[2] + 10 * (m[1] - 1)] = a[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 2:
        b[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 3:
        c[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 4:
        d[m[2] + 10 * (m[1] - 1)] = d[m[2] + 10 * (m[1] - 1)] + m[3]

for i in range(1, 4):
    for j in range(1, 11):
        print(' {0}'.format(a[j + 10 * (i - 1)]), end='')
    print()

print('####################')

for i in range(1, 4):
    for j in range(1, 11):
        print(' {0}'.format(b[j + 10 * (i - 1)]), end='')
    print()

print('####################')

for i in range(1, 4):
    for j in range(1, 11):
        print(' {0}'.format(c[j + 10 * (i - 1)]), end='')
    print()

print('####################')

for i in range(1, 4):
    for j in range(1, 11):
        print(' {0}'.format(d[j + 10 * (i - 1)]), end='')
    print()

Submission status: Wrong Answer

Solution code:
roomsOfBuilding = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for l in range(n):
    # b棟f階のr番目の部屋にv人
    b, f, r, v = map(int, input().split())
    roomsOfBuilding[b - 1][f - 1][r - 1] += v

for building in roomsOfBuilding:
    for rooms in building:
        for room in rooms:
            print(room, end=' ')
        print('')
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
home = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
N = int(input())
for i in range(N):
    a, b, c, d = map(int, input().split())
    home[a - 1][b - 1][c - 1] = d
for i in range(3):
    for j in range(3):
        for k in range(10):
            print(' ' + str(home[i][j][k]), end ='')
        print()
    print('####################')
for j in range(3):
    for k in range(10):
        print(' ' + str(home[3][j][k]), end ='')
    print()

Submission status: Wrong Answer

Solution code:
Residents = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    b ,f ,r ,v  = list(map(int,input().split()))
    Residents[b-1][f-1][r-1] += v
for k in range(4):
    for j in range(3):
        print(' '+ ' '.join(map(str,Residents[k][j])))
    print('####################')

Submission status: Wrong Answer

Solution code:
field = [[0 for i in range(10)]for i in range (15)]
num = int(input())
for i in range (num):
	b,f,r,v = map(int,input().split())
	field[((b-1)*4)+f-1][(r-1)] = v
for i in range(15):
	if( i % 4 == 3 ):
 		field[i] = ['#'*20]
for i in range(15):
	field[i] = map(str,field[i])
for i in range(15):
		if not( i % 4 == 3 ):
			print(' '+' '.join(field[i]))
		else:
			print(''.join(field[i]))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    a[b-1][f-1][r-1]=v
for i in range(4):
    for j in range(3):
        for e in range(10):
            print(' '+str(a[i][j][e]),end='')
        print()
    print('#'*20)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    a[b-1][f-1][r-1]=v
for i in range(4):
    for j in range(3):
        for e in range(10):
            print(' '+str(a[i][j][e]),end='')
        print()
    if i!=3:
        print('#'*20)

Submission status: Wrong Answer

Solution code:
# b棟f階r番目の部屋にv人追加
dom = {
    "1": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "2": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "3": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "4": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
}

n = int(input())
for i in range(n):
    b, f, r, v = input().split()
    dom[b][int(f)-1][int(r)-1] += int(v)

for i in ["1", "2", "3", "4"]:
    for j in range(len(dom[i])):
        for k in range(len(dom[i][j])):
            print(" {}".format(dom[i][j][k]), end="")
            # print("jの値: {}".format(j))
        print("")
        if j == 2:
            print("#" * 20)

Submission status: Wrong Answer

Solution code:
# b棟f階r番目の部屋にv人追加
dom = {
    "1": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "2": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "3": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "4": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
}

n = int(input())
for i in range(n):
    b, f, r, v = input().split()
    dom[b][int(f)-1][int(r)-1] += int(v)

for i in ["1", "2", "3", "4"]:
    for j in range(len(dom[i])):
        for k in range(len(dom[i][j])):
            print(" {}".format(dom[i][j][k]), end="")
        print("")
        if j == 2:
            print("#" * 20 + " ")

Submission status: Wrong Answer

Solution code:
# b棟f階r番目の部屋にv人追加
dom = {
    "1": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "2": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "3": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
    "4": [
        [0] * 10,
        [0] * 10,
        [0] * 10
    ],
}

n = int(input())
for i in range(n):
    b, f, r, v = input().split()
    dom[b][int(f)-1][int(r)-1] += int(v)

for i in ["1", "2", "3", "4"]:
    for j in range(len(dom[i])):
        for k in range(len(dom[i][j])):
            print(" {}".format(dom[i][j][k]), end="")
        print("")
        if j == 2:
            print("#" * 20)

Submission status: Wrong Answer

Solution code:
# b棟f階r番目の部屋にv人追加
doms = [[[0 for i in range(10)] for j in range(3)]for k in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = input().split()
    doms[int(b) - 1][int(f)-1][int(r)-1] += int(v)

for i, tou in enumerate(doms):
    for floor in tou:
        # print("floor : {}".format(floor))
        for room in floor:
            print(" {}".format(room), end="")
        print()
    print("#" * 20)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = [input().split() for _ in range(N)]

all_info = [[["0" for _ in range(10)] for _ in range(3)] for _ in range(4)]

def change_room(info):
    info = [int(i) for i in info]
    info_dic = {"all_info": all_info,
                "buil": info[0]-1,
                "loc" : info[1]-1,
                "room": info[2]-1,
                "num" : str(info[3])}

    exec("all_info[buil][loc][room] = num", info_dic)

for i in n:
    change_room(i)

for i in all_info:
    for j in i:
        print(" ".join(j))
    print("#"*20)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = [input().split() for _ in range(N)]

all_info = [[["0" for _ in range(10)] for _ in range(3)] for _ in range(4)]

def change_room(info):
    info = [int(i) for i in info]
    info_dic = {"all_info": all_info,
                "buil": info[0]-1,
                "loc" : info[1]-1,
                "room": info[2]-1,
                "num" : str(info[3])}

    exec("all_info[buil][loc][room] = num", info_dic)

for i in n:
    change_room(i)

for num, i in enumerate(all_info):
    for j in i:
        print(" " + (" ".join(j)))
    if num < N: 
        print("#"*20)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = [input().split() for _ in range(N)]

all_info = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

def change_room(info):
    info = [int(i) for i in info]
    info_dic = {"all_info": all_info,
                "buil": info[0]-1,
                "loc" : info[1]-1,
                "room": info[2]-1,
                "num" : info[3]}

    exec("all_info[buil][loc][room] += num", info_dic)

for i in n:
    change_room(i)

for num, i in enumerate(all_info):
    for j in i:
        j = [str(i) for i in j]
        print(" " + (" ".join(j)))
    if num < N: 
        print("#"*20)

Submission status: Wrong Answer

Solution code:
n = int(input())

h = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]

for i in range(n):
    b, f, r, v = map(int, input().split())
    h[b-1][f-1][r-1] += v

print(h)

Submission status: Wrong Answer

Solution code:
n = int(input())

h = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]

for i in range(n):
    b, f, r, v = map(int, input().split())
    h[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' '.join(map(str, h[i-1][j-1])))
    print('####################')

Submission status: Wrong Answer

Solution code:
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] = v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(house[i][j][k]), end='')
        print()
    if i != 4 - 1:
        print("#" * 20)

Submission status: Wrong Answer

Solution code:
n=int(input())
S=[]
for i in range(1200):
    S.append(0)

for i in range(n):
    k=input().split()
    b=int(k[0])
    f=int(k[1])
    r=int(k[2])
    v=int(k[3]) 
    S[(b-1)*30+(f-1)*10+r-1]+=v
for i in range(4):
    for j in range(3):
        msg=""
        for t in range(9):
            msg+=str(S[i*30+j*10+t])+" "
        msg+=str(S[i*30+j*10+9])
        print(msg)
    print("####################")

Submission status: Wrong Answer

Solution code:
n=int(input())
S=[]
for i in range(1200):
    S.append(0)

for i in range(n):
    k=input().split()
    b=int(k[0])
    f=int(k[1])
    r=int(k[2])
    v=int(k[3]) 
    S[(b-1)*30+(f-1)*10+r-1]+=v
for i in range(4):
    for j in range(3):
        msg=""
        for t in range(9):
            msg+=" "+str(S[i*30+j*10+t])
        print(msg)
    if i<3:
        print("####################")

Submission status: Wrong Answer

Solution code:
m=int(input())
d=[[[0 for i in range(10)]for j in range(3)] for k in range(4)]
for i in range(m):
    b,f,r,v=map(int,input().split())
    d[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(9):
            print(" ",end="")
            print(d[i][j][k],end="")
        print(" ",end="")
        print(d[i][j][k])
    if(i<=2):
        print("#"*20)

Submission status: Wrong Answer

Solution code:
# Official House

n = int(input())
houses = 4
floors = 3
rooms = 10

official = [[[0 for k in range(rooms)] for j in range(floors)] for i in range(houses)]
print(official)

for a in range(n):
    info = [int(x) for x in input().rstrip().split()]
    b = info[0] - 1
    f = info[1] - 1
    r = info[2] - 1
    v = info[3]
    currentFloor = official[b][f]
    print(currentFloor)
    currentFloor[r] += v

print(official)

for i in range(houses):
    for j in range(floors):
        roomList = [str(official[i][j][k]) for k in range(rooms)]
        print(' '.join(roomList))
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
# Official House

n = int(input())
houses = 4
floors = 3
rooms = 10

official = [[[0 for k in range(rooms)] for j in range(floors)] for i in range(houses)]
print(official)

for a in range(n):
    info = [int(x) for x in input().rstrip().split()]
    b = info[0] - 1
    f = info[1] - 1
    r = info[2] - 1
    v = info[3]
    currentFloor = official[b][f]
    print(currentFloor)
    currentFloor[r] += v

print(official)

for i in range(houses):
    for j in range(floors):
        roomList = [str(official[i][j][k]) for k in range(rooms)]
        print(' '.join(roomList))
    if i < houses - 1:
        print('#' * 20)

Submission status: Wrong Answer

Solution code:
def main():

    rooms = [[0 for i in range(10)] for j in range(12)]
    x = int(input())
    for _ in range(x):
        b, f, r, v = tuple(map(int, input().split()))
        rooms[(b-1)*3+(f-1)][r-1] = v

    for i in range(4):
        for j in range(3):
            for k in range(10):
                print(" "+str(rooms[i*3+j][k]), end="")
            print()
        print("#"*20)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():

    rooms = [[0 for i in range(10)] for j in range(12)]
    x = int(input())
    for _ in range(x):
        b, f, r, v = tuple(map(int, input().split()))
        rooms[(b-1)*3+(f-1)][r-1] = v

    for i in range(4):
        for j in range(3):
            for k in range(10):
                print(" "+str(rooms[i*3+j][k]), end="")
            print()
        if i != 3:
            print("#"*20)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    k = [[[0]*10]*3]*4
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, raw_input().split())
        k[b-1][f-1][r-1] += v

    for b in range(4):
        for f in range(3):
            print(" ".join(map(str, k[b][f])))
        if b != 3:
            print("#"*20)

main()

Submission status: Wrong Answer

Solution code:
n=int(raw_input())
l=[[[0 for k in range(10)]for j in range(3)]for i in range(4)]
for N in range(n):
        e=map(int,raw_input().split())
        b=e[0]-1
        f=e[1]-1
        r=e[2]-1
        l[b][f][r]+=e[3]
for i in range(4):
        for j in range(3):
                for k in range (10):
                        print l[i][j][k],
        print
        if i != 3:
                print "####################"

Submission status: Wrong Answer

Solution code:
import sys
houses = dict()
for lineCnt, line in enumerate(sys.stdin):
    if lineCnt == 0: continue
    b, f, r, v = map(int, line.rstrip('\n').split(' '))
    if houses.get((b, f, r)):
        houses[(b, f, r)] += v
    else:
        houses[(b, f, r)] = v

for b in range(1, 5):
    for f in range(1, 4):
        floor = ''
        for r in range(1, 11):
            if houses.get((b, f, r)):
                floor += '%2d' % houses.get((b, f, r))
            else:
                floor += ' 0'
        print floor
    print '#' * 20

Submission status: Wrong Answer

Solution code:
import sys
houses = dict()
for lineCnt, line in enumerate(sys.stdin):
    if lineCnt == 0: continue
    b, f, r, v = map(int, line.rstrip('\n').split(' '))
    if houses.get((b, f, r)):
        houses[(b, f, r)] += v
    else:
        houses[(b, f, r)] = v

for b in range(1, 5):
    for f in range(1, 4):
        floorLine = ''
        for r in range(1, 11):
            if houses.get((b, f, r)):
                floorLine += '%2d' % houses.get((b, f, r))
            else:
                floorLine += ' 0'
        print floorLine
    print '#' * 20

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math

A=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
B=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
C=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
D=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
l=[]
N=int(raw_input())
for i in range(N):
    (b,f,r,v)=map(int, raw_input().split())
    if b==0: A[f-1][r-1]+=v
    elif b==1: B[f-1][r-1]+=v
    elif b==2: C[f-1][r-1]+=v
    elif b==3: D[f-1][r-1]+=v


for j in A:
    print ' '.join(map(str, j))
print '#'*20 
for k in B:
    print ' '.join(map(str, k))
print '#'*20 
for l in C:
    print ' '.join(map(str, l))
print '#'*20 
for m in D:
    print ' '.join(map(str, m))

Submission status: Wrong Answer

Solution code:
mansion_list = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
n = input()
while (n>0):
	n -= 1
	b, f, r, v = map(int, raw_input().split())
	mansion_list[b-1][f-1][r-1] += v
for b in range(0, 4):
	for f in range(0, 3):
		line = ''
		for r in range(0, 10):
			line += str(mansion_list[b][f][r]) + ' '
		print line
	print '#'*20

Submission status: Wrong Answer

Solution code:
mansion_list = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
n = input()
while (n>0):
	n -= 1
	b, f, r, v = map(int, raw_input().split())
	mansion_list[b-1][f-1][r-1] += v
for b in range(0, 4):
	for f in range(0, 3):
		line = ' '
		for r in range(0, 10):
			line += str(mansion_list[b][f][r]) + ' '
		print line
	print '#'*20

Submission status: Wrong Answer

Solution code:
mansion_list = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
n = input()
while (n>0):
	n -= 1
	b, f, r, v = map(int, raw_input().split())
	mansion_list[b-1][f-1][r-1] += v
for b in range(0, 4):
	for f in range(0, 3):
		line = ''
		for r in range(0, 10):
			line += ' ' + str(mansion_list[b][f][r])
		print line
	print '#'*20

Submission status: Wrong Answer

Solution code:
mansion_list = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
n = input()
while (n>0):
	n -= 1
	b, f, r, v = map(int, raw_input().split())
	mansion_list[b-1][f-1][r-1] += v
for b in range(0, 4):
	for f in range(0, 3):
		line = str(mansion_list[b][f][0])
		for r in range(1, 10):
			line += ' ' + str(mansion_list[b][f][r])
		print line
	print '#'*20

Submission status: Wrong Answer

Solution code:
mansion_list = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
n = input()
while (n>0):
	n -= 1
	b, f, r, v = map(int, raw_input().split())
	mansion_list[b-1][f-1][r-1] += v
for b in range(0, 4):
	for f in range(0, 3):
		line = '  ' + str(mansion_list[b][f][0])
		for r in range(1, 10):
			line += ' ' + str(mansion_list[b][f][r])
		print line
	print '#'*20

Submission status: Wrong Answer

Solution code:
a = [] 
for i in xrange(0,4):
    b = []
    for j in xrange(0,3):
        b.append([0]*10)
    a.append(b)
n = int(raw_input())
for i in xrange(0,n):
    b,f,r,v = map(int,raw_input().split())
    a[b-1][f-1][v-1] += v
for i,arr in enumerate(a):
    for j in arr:
        print " ".join(map(str,j))
    if i != len(a)-1:
        print "#"*20

Submission status: Wrong Answer

Solution code:
bilding = [[[0 for i in range(10)] for j in range(3)]for k in range(4)]

Submission status: Wrong Answer

Solution code:
k = [[[0 for x in range(10)] for x in range(3)] for x in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    k[b-1][f-1][r-1] += v

Submission status: Wrong Answer

Solution code:
bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Wrong Answer

Solution code:
rooms = [[[0 for i in range(10)] for j in range(3)] for h in range(4)]
n = input()
for i in range(n):
	b, f, r, v = map(int, raw_input().split())
	rooms[b-1][f-1][r-1] = rooms[b-1][f-1][r-1] + v

for i in rooms:
	for j in i:
		print " ".join(map(str, j))
	print "#" * 20

Submission status: Wrong Answer

Solution code:
a = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
print(a)
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().strip().split())
    a[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in range(3):
        print(''.join(' {}'.format(a[b][f][r]) for r in range(10)))
    if b < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
import sys


def main():
    n = int(sys.stdin.readline())
    notices = []
    for i in range(n):
        notices.append(tuple(map(int, sys.stdin.readline().split())))
    buildings = [[[0] * 10 for i in range(3)] for j in range(4)]
    for b, f, r, v in notices:
        buildings[b-1][f-1][r-1] += v
    separator = '####################'
    for index, building in enumerate(buildings):
        for floor in building:
            print(' ' + ' '.join(map(str, floor)))
        if index != len(buildings)-1:
            print(separator)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=[[[0 for _ in range(10)]for _ in range(3)]for _ in range(4)]
for i in range(n):
    b,f,r,v=map(int, input().split())
    a[b-1][f-1][r-1]+=v
for bb in range(4):
    for ff in range(3):
        print(*[""]+a[bb][ff])
    if bb==3:
        break
    else:
        print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
start=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    b,f,r,v=[int(i) for i in input().split()]
    start[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ",end="")
            print(start[i][j][k],end="")
        print()
    if i<=2:
        for m in range(20):
            print("#",end="")
        print()

Submission status: Accepted

Solution code:

bil_date = []
flag = 0
for i in range(4):
    bil_date.append([[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]])
all_date_amo = int(input())
for i in range(all_date_amo):
    date = [int(indate) for indate in input().split()]
    bil_date[date[0]-1][date[1]-1][date[2]-1] = bil_date[date[0]-1][date[1]-1][date[2]-1] + date[3]
    if bil_date[date[0]-1][date[1]-1][date[2]-1] < 0:
        bil_date[date[0]-1][date[1]-1][date[2]-1] = 0
    if bil_date[date[0]-1][date[1]-1][date[2]-1] > 9:
        bil_date[date[0]-1][date[1]-1][date[2]-1] = 9
        
for bil in bil_date:
    for flo in bil:
        for room in flo:
            print(' {}'.format(room),end='')
        print('')
    if flag == 3:
        pass
    else:
        for i in range(20):
            print('#',end='')
        print('')
    flag = flag + 1

Submission status: Accepted

Solution code:
houses = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())

for i in range(n):
    b, f, r, v = map(int, input().split())
    houses[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in houses[b]:
        print('', *f)
    if b != 3:
        print('#' * 20)

Submission status: Accepted

Solution code:
num = input()
L = []
house = []
for i in range(int(num)):
    k = input().split()
    k[0] = int(k[0])
    k[1] = int(k[1])
    k[2] = int(k[2])
    k[3] = int(k[3])
    L.append(k)

for i in range(3):
    a = ["","0","0","0","0","0","0","0","0","0","0"]
    b = ["","0","0","0","0","0","0","0","0","0","0"]
    c = ["","0","0","0","0","0","0","0","0","0","0"]
    d = ["#"*20]
    house.append([a,b,c,d])

a = ["","0","0","0","0","0","0","0","0","0","0"]
b = ["","0","0","0","0","0","0","0","0","0","0"]
c = ["","0","0","0","0","0","0","0","0","0","0"]
house.append([a,b,c])

for i in L:
    house[i[0]-1][i[1]-1][i[2]] = str(int(house[i[0]-1][i[1]-1][i[2]])+i[3])

for i in house:
    for j in i:
        k = " ".join(j)
        print(k)

Submission status: Accepted

Solution code:
# coding: utf-8

def showBuilding(buildings):
    for i, tou in enumerate(buildings):
        for wow in tou:
            for room in wow:
                print(' ' + str(room), end='')
            print()
        if i != 3:
            print('####################')


if __name__ == '__main__':
    
    buildings = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
    
    for _ in range(int(input())):
    
        b, f, r, v = map(int, input().split())
    
        if buildings[b - 1][f - 1][r - 1] + v >= 9:
            buildings[b - 1][f - 1][r - 1] = 9
        elif buildings[b - 1][f - 1][r - 1] + v < 0:
            buildings[b - 1][f - 1][r - 1] = 0
        else:
            buildings[b - 1][f - 1][r - 1] += v
    
    showBuilding(buildings)

Submission status: Accepted

Solution code:
# coding: utf-8

def showBuilding(mansion):
    for i, building in enumerate(mansion):
        for line in building:
            for room in line:
                print(' ' + str(room), end='')
            print()
        if i != 3:
            print('####################')

def calcMoving(mansion, moving_status):
    b, f, r, v = moving_status
    live_in_person = mansion[b-1][f-1][r-1]
    
    if live_in_person + v >= 9:
        live_in_person = 9
    elif live_in_person + v < 0:
        live_in_person = 0
    else:
        live_in_person += v
    
    mansion[b-1][f-1][r-1] = live_in_person

if __name__ == '__main__':
    mansion = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
    
    for _ in range(int(input())):
        calcMoving(mansion, map(int, input().split()))

    showBuilding(mansion)

Submission status: Accepted

Solution code:
# coding: utf-8

def showBuilding(mansion):
    for i, building in enumerate(mansion):
        for line in building:
            for room in line:
                print(' ' + str(room), end='')
            print()
        if i != 3:
            print('####################')

if __name__ == '__main__':
    mansion = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
    
    for _ in range(int(input())):
        b, f, r, v = map(int, input().split())
        mansion[b-1][f-1][r-1] += v

    showBuilding(mansion)

Submission status: Accepted

Solution code:
# coding: utf-8

def showBuilding(mansion):
    for i, building in enumerate(mansion):
        for line in building:
            for room in line:
                print(' ' + str(room), end='')
            print()
        if i != 3:
            print('#' * 20)

if __name__ == '__main__':
    mansion = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
    
    for _ in range(int(input())):
        b, f, r, v = map(int, input().split())
        mansion[b-1][f-1][r-1] += v

    showBuilding(mansion)

Submission status: Accepted

Solution code:
n = int(input())
values = [input().split() for i in range(n)]

# Initialize Array
a = [["#" if i > 0 and i % 4 == 3 else 0 for j in range(10)] for i in range(15)]

# Search
for value in values:
    b, f, r, v = map(int, value)
    a[4 * b + f - 5][r - 1] += v

# Output
for i in range(15):
    row_output = ""
    for j in range(10):
        if i > 0 and i % 4 == 3:
            row_output += "##"
        else:
            row_output += " " + str(a[i][j])
    print(row_output)

Submission status: Accepted

Solution code:
array = [[10*[0] for _ in [0]*3] for _ in [0]*4]
n = int(input())
for _ in range(n):
    a,b,c,d = map(int,input().split())
    array[a-1][b-1][c-1] += d
for i in range(4):
    for j in range(3): print('',*array[i][j])
    if i<3: print('#'*20)

Submission status: Accepted

Solution code:
home = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(raw_input())
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    home[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print "",
        print " ".join(map(str, home[i][j]))
        if j == 2 and i != 3:
            print "#" * 20

Submission status: Accepted

Solution code:
university = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    university[b - 1][f - 1][r - 1] += v
c1 = c2 = 0
for building  in university:
    c2 = 0
    for floor in building:
        for room in floor:
            print(' {}'.format(room), end = '')
        if c2 != 2:
            print('')
        c2 += 1
    if c1 != 3:
        print('\n####################')
    c1 += 1
print('')

Submission status: Accepted

Solution code:
a = [[[0] * 10 for i in range(3)] for j in range(4)]

n = int(input())

for _ in range(n):
    [b, f, r, v] = [int(j) - 1 for j in input().split()]
    a[b][f][r] += v + 1

for i, d in enumerate(a):
    for c in d: print("", *c)
    if i != len(a) - 1:
        print("#" * 20)

Submission status: Accepted

Solution code:
billdings = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]


def printstate(billdings):
    """
    for billnum, billding in enumerate(billdings):
        for flooor in billding:
            for room in flooor:
                print(" {}".format(room), end="")
            print()
        print("#"*20 if billnum != len(billdings)-1 else "")
    """
    for i in range(len(billdings)):
        for j in range(len(billdings[0])):
            for k in range(len(billdings[0][0])):
                print(" "+str(billdings[i][j][k]), end="")
            print()
        if i != len(billdings)-1:
            print("#"*20)


n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    b, f, r = b-1, f-1, r-1
    billdings[b][f][r] += v

printstate(billdings)

Submission status: Accepted

Solution code:
n = int(input())
a = list()
for i in range(120):
	a.append(0)
for i in range(n):
	b, f, r, v = map(int, input().split())
	a[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
for i in range(4):
	if i >= 1:
		print("#" * 20)
	for j in range(3):
		for k in range(10):
			print(' ', end = '')
			print(a[i * 30 + j * 10 + k], end = '')
		print()