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: Accepted

Solution code:
room = [[[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())
  room[b-1][f-1][r-1] += v

sep = "#"*20

for i in range(4):
  for j in range(3):
    print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i][j][2],room[i][j][3],room[i][j][4],room[i][j][5],room[i][j][6],room[i][j][7],room[i][j][8],room[i][j][9]))
  if i < 3:
    print(sep)

Submission status: Accepted

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

Submission status: Accepted

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)] = c[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: Accepted

Solution code:
F = [0 for i in range(10)]
def dfloor(l):
    f = F.copy()
    f[l[0]-1] = l[1]
    return f

H = {1:[F,F,F],
    2:[F,F,F],
    3:[F,F,F],
    4:[F,F,F]}
N = int(input())
p = 0
for n in range(N):
    a,b,c,d = tuple(int(n) for n in input().split())
    H[a][b-1] = [H[a][b-1][h]+dfloor([c,d])[h] for h in range(10)]
for I in H.values():
    p += 1
    for i in I:
        print(" " + " ".join(map(str,i)))
    if p != 4:
        print("#"*20)

Submission status: Accepted

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
counter = 0
for building in roomsOfBuilding:
    counter += 1
    for rooms in building:
        for room in rooms:
            print(' ' + str(room), end='')
        print('')
    if counter < 4:
        print('#' * 20)

Submission status: Accepted

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(' ',end='')
			if k != 9:
				print(house[i][j][k],end='')
			else:
				print(house[i][j][k])
	if i<3:
		print('####################')

Submission status: Accepted

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: Accepted

Solution code:
情報数 = int(input())

現在の校舎状態 = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]

for i in range(情報数):
    棟, 階, 部屋番号, 追加人数 = map(int, input().split())
    現在の校舎状態[棟-1][3-階][部屋番号-1] += 追加人数

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", end='')
            print(現在の校舎状態[i][2-j][k], end='')
        print()
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
#! python3
# official_house.py

n = int(input())
rooms = [[int(x) for x in input().split(' ')] for i in range(n)]

rooms_people = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
for i in range(n):
    rooms_people[rooms[i][0]-1][rooms[i][1]-1][rooms[i][2]-1] += rooms[i][3]

for i in range(4):
    if i != 0: print('####################')
    for j in range(3):
        for k in range(10):
            print('', rooms_people[i][j][k], end='')
        print('')

Submission status: Accepted

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])))
    if (k ==3): break
    print('####################')

Submission status: Accepted

Solution code:
a=[[10*[0]for _ in[0]*3]for _ in[0]*4]
for _ in[0]*int(input()):
 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):print('',*a[i][j])
 if i<3:print('#'*20)

Submission status: Accepted

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: Accepted

Solution code:
field = [[0 for i in range(10)]for i in range(15)]
nums = int(input())
for i in range(nums):
	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):
		print('#'*20)
	else:
		print(' '+' '.join(map(str,field[i])))

Submission status: Accepted

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

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

for b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, num[b][f])))
    if b < 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
ichi=[0,0,0,0,0,0,0,0,0,0,0,0]
ni=[0,0,0,0,0,0,0,0,0,0,0,0]
san=[0,0,0,0,0,0,0,0,0,0,0,0]
yon=[0,0,0,0,0,0,0,0,0,0,0,0]
go=[0,0,0,0,0,0,0,0,0,0,0,0]
roku=[0,0,0,0,0,0,0,0,0,0,0,0]
nana=[0,0,0,0,0,0,0,0,0,0,0,0]
hachi=[0,0,0,0,0,0,0,0,0,0,0,0]
kyu=[0,0,0,0,0,0,0,0,0,0,0,0]
zyu=[0,0,0,0,0,0,0,0,0,0,0,0]
zyu_ichi=[0,0,0,0,0,0,0,0,0,0,0,0]
zyu_ni=[0,0,0,0,0,0,0,0,0,0,0,0]

while n>0:
    l=input().split()
    b=int(l[0])
    f=int(l[1])
    r=int(l[2])
    v=int(l[3])

    num=3*(b-1)+f

    if num==1:
        ichi[r-1]+=v
    elif num==2:
        ni[r-1]+=v
    elif num==3:
        san[r-1]+=v
    elif num==4:
        yon[r-1]+=v
    elif num==5:
        go[r-1]+=v
    elif num==6:
        roku[r-1]+=v
    elif num==7:
        nana[r-1]+=v
    elif num==8:
        hachi[r-1]+=v
    elif num==9:
        kyu[r-1]+=v
    elif num==10:
        zyu[r-1]+=v
    elif num==11:
        zyu_ichi[r-1]+=v
    else:
        zyu_ni[r-1]+=v
    n=n-1
m=1
A=" "+str(ichi[0])
B=" "+str(ni[0])
C=" "+str(san[0])
D=" "+str(yon[0])
E=" "+str(go[0])
F=" "+str(roku[0])
G=" "+str(nana[0])
H=" "+str(hachi[0])
I=" "+str(kyu[0])
J=" "+str(zyu[0])
K=" "+str(zyu_ichi[0])
L=" "+str(zyu_ni[0])
while m<10:
    A=A+" "+str(ichi[m])
    B=B+" "+str(ni[m])
    C=C+" "+str(san[m])
    D=D+" "+str(yon[m])
    E=E+" "+str(go[m])
    F=F+" "+str(roku[m])
    G=G+" "+str(nana[m])
    H=H+" "+str(hachi[m])
    I=I+" "+str(kyu[m])
    J=J+" "+str(zyu[m])
    K=K+" "+str(zyu_ichi[m])
    L=L+" "+str(zyu_ni[m])
    m=m+1
print(A)
print(B)
print(C)
print("####################")
print(D)
print(E)
print(F)
print("####################")
print(G)
print(H)
print(I)
print("####################")
print(J)
print(K)
print(L)

Submission status: Accepted

Solution code:
n = int(input())
apart = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for joho in range(n):
    x = [int(i) for i in input().split()]
    apart[x[0]-1][x[1]-1][x[2]-1] += x[3]

for tou in range(4):
    for stair in range(3):
        for room in range(10):
            print(" ",apart[tou][stair][room],sep="",end="")
        print("")
    if tou != 3:
        print("####################")

Submission status: Accepted

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: Accepted

Solution code:
import sys
 
x = []
i = 0
for line in sys.stdin:
    if i==0:
        lx = int(line)
    else:
        x.append([int(i) for i in line.split()])
    i = 1
 
rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
for e in x:
    i,j,k,l = e
    rooms[i-1][j-1][k-1] += l
 
for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i<len(rb)-1: print '#' * 20

Submission status: Accepted

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()
    if i < 3:
        print("#" * 20)

Submission status: Accepted

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("")
    if i < 3:
        print("#" * 20)

Submission status: Accepted

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

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

is_first = True
for building in nums:
    if not is_first:
        print("#" * 20)
    is_first = False 
    for floor in building:
        for room in floor:
            print(" " + str(room), end = "")
        print()

Submission status: Accepted

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 < 3: 
        print("#"*20)

Submission status: Accepted

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, building in enumerate(house, 1):
    for floor in building:
        for room in floor:
            print(' {0}'.format(room), end='')
        print()
    if i != 4:
        print('#' * 20)

Submission status: Accepted

Solution code:
# AOJ ITP1_6_C

def numinput():
    # たとえば1 2 3 4という出力に対して[1, 2, 3, 4]を生成する。
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    data = []
    for i in range(4):
        floor = []
        for j in range(3):
            list = []
            for k in range(10):
                list.append(0)
            floor.append(list)
        data.append(floor)
    # これでdata[0], data[1], data[2], data[3]が各フロアを意味する。
    # 階数が各々0, 1, 2だけど出力と入力が1ずつズレてる。
    n = int(input())
    for i in range(n):
        info = numinput()
        # info[0]が1, 2, 3, 4で棟の数(1引く)
        # info[1]が1, 2, 3で階の数(1引く)
        # info[2]が1, 2, ..., 10で部屋の数(1引く)
        # info[3]が整数で入るとか出るとか。
        data[info[0] - 1][info[1] - 1][info[2] - 1] += info[3]

    # 出力は注意を要する。0, 1, 2, 3棟の順に0階、・・。
    for i in range(4):
        for j in range(3):
            _str_ = ""
            for k in range(10):
                _str_ += " " + str(data[i][j][k])
            print(_str_)
        if i < 3: print("####################")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
floar = [[[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())
    floar[b-1][f-1][r-1] += v
for i in range(4):
    if(i != 0):
        print('#'*20)
    for j in range(3):
        print(' ',end="")
        print(*floar[i][j])

Submission status: Accepted

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: Accepted

Solution code:
import sys

r_len = 10
f_len = 3
b_len = 4

rooms = [[[0 for x in range(r_len)] for y in range(f_len)] for z in range(b_len)]

n = int(input())
for i in range(n):
	arr = list(map(int, input().split()))
	b = arr[0] - 1
	f = arr[1] - 1
	r = arr[2] - 1
	v = arr[3]
	rooms[b][f][r] += v

for i in range(b_len):
	for j in range(f_len):
		for k in range(r_len):
			v = rooms[i][j][k]
			sys.stdout.write(' ' + str(v))
		print()
	if i != b_len - 1:
		print('####################')

Submission status: Accepted

Solution code:
bfr = [[[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())
    bfr[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print(' ' + ' '.join(map(str, bfr[b][f])))
    if b != 3:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
lis = {}
X =""
for a in range(1,5):
    for b in range(1,4):
        for c in range(1,11):
            fn = lambda A,B,C,D : lis.setdefault(f"{str(A)} {str(B)} {str(C)}",int(D))
            fn(a,b,c,0)
for x in range(n):
    b, f, r, v = map(int, input().split())
    lis[f"{str(b)} {str(f)} {str(r)}"] += v
for a in range(1,5):
    for b in range(1,4):
        for c in range(1,11):
            X += " " + str(lis[f"{str(a)} {str(b)} {str(c)}"])
        print(X)
        X = ""
    if a == 4:
        break
    print("#"*20)

Submission status: Accepted

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(10):
            msg+=" "+str(S[i*30+j*10+t])
        print(msg)
    if i<3:
        print("####################")

Submission status: Accepted

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][9])
    if(i<=2):
        print("#"*20)

Submission status: Accepted

Solution code:

import sys

c = int(input())

a = []
for line in sys.stdin :
    a.append(line)
    c -= 1
    if c == 0 :
        break

for i in range(0, len(a)) :
    a[i] = a[i].strip().split(" ")
    for j in range(0, len(a[i])) :
        a[i][j] = int(a[i][j])

kousya = [
[
[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, 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]
]
]

for i in a :
    kousya[i[0]-1][i[1]-1][i[2]-1] += i[3]

touc = 0
for tou in kousya :
    for kai in tou :
        for heya in kai :
            print(" " + str(heya), end="")
        print()
    if touc != len(kousya)-1 :
        print("#"*20)
    touc += 1

Submission status: Accepted

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):
        for k in range(rooms):
            print(' ' + str(official[i][j][k]), end = '')
        print()
    if i < houses - 1:
        print('#' * 20)

Submission status: Accepted

Solution code:
a = [[[0 for i in range(10)]for i in range(3)]for i in range(4)]
border = '#'*20
n = int(input())
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 k in a[i]:
        for l in k:
                print(' {}'.format(l), end ='')
        print()
    if i != 3:
        print(border)

Submission status: Accepted

Solution code:
n = int(input())
L = [[[0]*10  for i in range(3)] for j in range(4)]
for i in range(n):
	b, f, r, v = list(map(int, input().split()))
	L[b-1][f-1][r-1] += v
for i in range (4):
	for j in range(3):
		for k in range(10):
			print(" {}".format(L[i][j][k]), end="")
		print()
	if i != 3:
		print("#" *20)

Submission status: Accepted

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: Accepted

Solution code:
def main():
    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

    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: Accepted

Solution code:
import sys

x = []
i = 0
for line in sys.stdin:
    if i==0:
        lx = int(line)
    else:
        x.append([int(i) for i in line.split()])
    i = 1

rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
for e in x:
    i,j,k,l = e
    rooms[i-1][j-1][k-1] += l

for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i<len(rb)-1: print '#' * 20

Submission status: Accepted

Solution code:
rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]

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

for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i < len(rb)-1:
        print '#' * 20

Submission status: Accepted

Solution code:
def perl():
        for i in range(4):
                for j in range(3):
                        print "",
                        for k in range (10):
                                print l[i][j][k],
                        print
                if i != 3:
                        print "####################"

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]
perl()

Submission status: Accepted

Solution code:
from __future__ import division, print_function
from sys import stdin
houses = [[[0] * 10 for _ in range(3)] for _ in range(4)]
separator = '#' * 20
for _ in range(int(stdin.readline())):
    b, f, r, v = (int(s) for s in stdin.readline().split())
    houses[b-1][f-1][r-1] += v
for i, house in enumerate(houses):
    for floor in house:
        print('', *floor)
    if i < 3:
        print(separator)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function

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==1: A[f-1][r-1]+=v
    elif b==2: B[f-1][r-1]+=v
    elif b==3: C[f-1][r-1]+=v
    elif b==4: 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: Accepted

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][r-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: Accepted

Solution code:
def main():
    for i in xrange(n):
        b, f, r, v = map(int, raw_input().split())
        x[b-1][f-1][r-1] += v
    for b in range(4):
        for f in range(3):
            print(' ' + ' '.join(map(str,x[b][f])))
        if b != 3:
            print('#'*20)

n = input()
x = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
main()

Submission status: Accepted

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

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

Submission status: Accepted

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 range(len(rooms)):
	for j in rooms[i]:
		print " " + " ".join(map(str, j))
	if i != 3: print "#" * 20

Submission status: Accepted

Solution code:
check = [[[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())
    check[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {check[i][j][k]}", end="")
        print()
    if i<3:
        print("####################")

Submission status: Accepted

Solution code:
N=int(input())
room=[[[0]*10 for _ in range(3)] for _ in range(4)]

for _ in range(N):
    b,f,r,v=map(int,input().split())
    room[b-1][f-1][r-1]+=v
    
for i in range(4):
    for j in range(3):
        for k in range(10):
             print(" {}".format(room[i][j][k]),end="")
        print()
    if i!=3:
        print("####################")

Submission status: Accepted

Solution code:
# coding: utf-8

all_info = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
ct = int(input())

for i in range(ct):
    building,floor,room_num,people = (int(x) for x in input().split())
    all_info[building-1][floor-1][room_num-1] += people

for i,build in enumerate(all_info):
    for flo in build:
        temp = " " + " ".join(map(str,flo))
        print(temp)
    if i != len(all_info) - 1:
        print("#" * 20)

Submission status: Accepted

Solution code:
table = [[[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())
    table[b-1][f-1][r-1] = table[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(table[i][j][k], end="")
        print()
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
S=[]
H=[]
C=[]
D=[]
count=0
for i in range(0,30):
    S.append(0)
    H.append(0)
    C.append(0)
    D.append(0)

n=(int)(input())

for h in range(n):
    b,f,r,v=map(int,input().split())
    if b==1:
        if f==1:
            S[r-1]=S[r-1]+v
        if f==2:
            S[9+r]=S[9+r]+v
        if f==3:
            S[19+r]=S[19+r]+v
    elif b==2:
        if f==1:
            H[r-1]=H[r-1]+v
        if f==2:
            H[9+r]=H[9+r]+v
        if f==3:
            H[19+r]=H[19+r]+v
    elif b==3:
        if f==1:
            C[r-1]=C[r-1]+v
        if f==2:
            C[9+r]=C[9+r]+v
        if f==3:
            C[19+r]=C[19+r]+v
    elif b==4:
        if f==1:
            D[r-1]=D[r-1]+v
        if f==2:
            D[9+r]=D[9+r]+v
        if f==3:
            D[19+r]=D[19+r]+v

for j in range(len(S)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(S[j]),end="")
print("")
print("####################")
for j in range(len(H)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(H[j]),end="")
print("")
print("####################")
for j in range(len(C)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(C[j]),end="")
print("")
print("####################")
for j in range(len(D)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(D[j]),end="")
print("")

Submission status: Accepted

Solution code:
my_a = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_b = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_c = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_d = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
buildings = [my_a, my_b, my_c, my_d]

n=int(input())


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



for j in range(4):
    for k in range(3):
        for l in range(10):
            print(" ",end="")
            print(buildings[j][k][l], end="")
            
        print()
    if j < 3:
        for m in range(20):
            print("#",end="")
        print()

Submission status: Accepted

Solution code:
n = int(input())
#floor = [0 for i in range(1, 11)]
my_a = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_b = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_c = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
my_d = [[0 for i in range(1, 11)], [0 for i in range(1, 11)], [
    0 for i in range(1, 11)]]
bs = [my_a, my_b, my_c, my_d]

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

for i in range(len(bs)):
    for j in range(len(bs[0])):
        print(" ", end="")
        tmp_str = [str(i) for i in bs[i][j]]
        print(" ".join(tmp_str))
    if i != len(bs)-1:
        print("####################")

Submission status: Accepted

Solution code:
n = int(input())
record = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for _ in range(n):
    b, f, r, v = [int(x) for x in input().split()]
    record[b-1][f-1][r-1] += v
for b in range(4):
    for f in record[b]:
        print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
from copy import deepcopy
n = int(input())
b1 = [[0]*10,[0]*10,[0]*10]
b2 = deepcopy(b1)
b3 = deepcopy(b1)
b4 = deepcopy(b1)
answer = [b1,b2,b3,b4]
for i in range(n):
	b,f,r,v = map(int,input().split())
	answer[b-1][f-1][r-1] += v
counter = 0
for k in answer:
	for kk in k:
		kk = list(map(str,kk))
		print(" "," ".join(kk),sep="")
	counter += 1
	if counter != 4:
		print("#"*20)