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:
def decrement(*args):
  return [elm-1 for elm in args]

B,F,R = 4,3,10

a = [[[0 for _ in range(R)]for _ in range(F)]for _ in range(B)]

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

for x in a[0]:
  print('',end=' ')
  print(*x)
print("####################")
for x in a[1]:
  print('',end=' ')
  print(*x)
print("####################")
for x in a[2]:
  print('',end=' ')
  print(*x)
print("####################")
for x in a[3]:
  print('',end=' ')
  print(*x)

Submission status: Accepted

Solution code:
count = [[[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())
    count[a - 1][b - 1][c - 1] += d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(count[i][j][k]) , end="")
        print()
    if i < 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
lst=[['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['####################'],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['####################'],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['####################'],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0],['',0,0,0,0,0,0,0,0,0,0]]
ls1=lst[0]
ls2=lst[1]
ls3=lst[2]
ls4=lst[3]
ls5=lst[4]
ls6=lst[5]
ls7=lst[6]
ls8=lst[7]
ls9=lst[8]
ls10=lst[9]
ls11=lst[10]
ls12=lst[11]
ls13=lst[12]
ls14=lst[13]
ls15=lst[14]
n=int(input())
for i in range(n):
    b,f,r,v=(int(x) for x in input().split())
    if b==1:
        if f==1:
            ls1[r]+=v
        elif f==2:
            ls2[r]+=v
        else:
            ls3[r]+=v
    elif b==2:
        if f==1:
            ls5[r]+=v
        elif f==2:
            ls6[r]+=v
        else:
            ls7[r]+=v
    elif b==3:
        if f==1:
            ls9[r]+=v
        elif f==2:
            ls10[r]+=v
        else:
            ls11[r]+=v
    else:
        if f==1:
            ls13[r]+=v
        elif f==2:
            ls14[r]+=v
        else:
            ls15[r]+=v
for l in lst:
    print(*l)

Submission status: Accepted

Solution code:
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]]

x = int(input())
for i in range(x):
  b,f,r,v = map(int, 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
  else:
    D[f-1][r-1] += v

for i in range(3):
  text = " "
  temp = " ".join(map(str, A[i]))
  text += temp
  print(text)
print("####################")
for i in range(3):
  text = " "
  temp = " ".join(map(str, B[i]))
  text += temp
  print(text)
print("####################")
for i in range(3):
  text = " "
  temp = " ".join(map(str, C[i]))
  text += temp
  print(text)
print("####################")
for i in range(3):
  text = " "
  temp = " ".join(map(str, D[i]))
  text += temp
  print(text)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
buildings = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
space = '#' * 20

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

i = 0
while 1:
  for floor in buildings[i]:
    residents =""
    for room in floor:
      residents += " " + str(room)
    print(residents)
  i += 1
  if i == 4:
    break 
  else:
    print(space)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
table = [[[0] * 10 for _ in range(3)] for __ in range(4)]

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

x = 0
for i in range(4):
  if x != 0:
    print("#" * 20)
  x += 1

  for j in range(3):
    for k in range(10):
      print (" %d" %(table[i][j][k]), end = "")
    print()

Submission status: Accepted

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

for n,Ai in enumerate(A):
    for ai in Ai:
        for i in ai:
            print("",i,end="")
        print()
    if n==3:
        break
    print("#"*20)

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:
L = [[[0] * 10 for i in range(3)] for j in range(4)]
n = int(input())
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 + 1 != 4:
    print("#" * 20)

Submission status: Accepted

Solution code:
table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

N = int(input())

for loop in range(N):
    house_id,floor,room,add = map(int,input().split())
    table[house_id-1][floor-1][room-1] += add


x = 0

for i in range(4):
    if x != 0:
        print("#"*20)
    x += 1

    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for l 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 k in range(10):
            print(" "+str(a[i][j][k]), end="")
        print()
    if i!=3:
        print("####################")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[[[0 for l 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())
    a[b-1][f-1][r-1]+=v
for j in range(4):
    for k in range(3):
        for l in range(10):
            print(' '+str(a[j][k][l]), end='')
        print()
    if(j!=3):
        print('####################')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

b_cnt = 0
for floor in count:
    if b_cnt != 0:
        print("#" * 20)
    b_cnt += 1
    
    for room in floor:
        print("", *room)

Submission status: Accepted

Solution code:
n=int(input())
l1=[[[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())
    l1[b-1][f-1][r-1]=v+l1[b-1][f-1][r-1]
#リストに入れる
    
for x in range(4):
    y=0
    for y in range(3):
        bf=l1[x][y]
        print(" "+" ".join(map(str, bf)))
        y=y+1
    if x<3:
        print("#"*20)    
        x=x+1
    else:
        break
#出力

Submission status: Accepted

Solution code:
n = int(input())
L = [[[0]*10 for i in range(3)] for j in range(4)]
cnt = 0
while cnt < n:
    b, f, r, v = map(int, input().split())
    L[b-1][f-1][r-1] += v
    cnt += 1
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:
n = int(input())

p = [[0] * 30 for x in range(4)]

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

for i in range(0, 4):
  if i >= 1:
    print('#' * 20)
  for j in range(0, 3):
    for k in range(0, 10):
      print(' ', end='')
      print(p[i][j * 10 + k], end = '')
    print()

Submission status: Accepted

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

Submission status: Accepted

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

for bi, b in enumerate(rooms):
    for f in b:
        print('', *f)
    if 0 <= bi < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int( input() )

Floor_list = [[[0 for x in range(10)] for j in range(3)] for i in range(4)]

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

for b in range(4):
    for f in Floor_list[b]:
        print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("".join(["#" for x in range(20)]))

Submission status: Accepted

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

n = int(input())

for _ in range(n):
    b, f, r, v = map(int, input().split())
    table[b-1][f-1][r-1] += v
    
i = 0
for building in table:
    for floor in building:
        print(' ' + ' '.join(list(map(str, floor))))
    if i != 3:
        print('####################')
    i += 1

Submission status: Accepted

Solution code:
count=int(input())
aBuilding = [[0 for j in range(10)] for i in range(3)]
bBuilding = [[0 for j in range(10)] for i in range(3)]
cBuilding = [[0 for j in range(10)] for i in range(3)]
dBuilding = [[0 for j in range(10)] for i in range(3)]

for i in range(count):
    b,f,r,v = map(int,input().split())
    if b ==1:
        aBuilding[f-1][r-1]+=v
    elif b ==2:
        bBuilding[f-1][r-1]+=v        
    elif b ==3:
        cBuilding[f-1][r-1]+=v
    elif b ==4:
        dBuilding[f-1][r-1]+=v

def printInfo(building):
    for i in range(3):
        for x in range(10):
            print('',end=' ')
            print(building[i][x] , end='')
        print('')
printInfo(aBuilding)
print('####################')
printInfo(bBuilding)
print('####################')
printInfo(cBuilding)
print('####################')
printInfo(dBuilding)

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:
buildings = [[[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 = list(map(int, input().split()))
    buildings[b - 1][f - 1][r - 1] += v

for b in range(len(buildings)):
    if 0 < b:
        print("####################")

    for f in range(len(buildings[b])):
        for r in range(len(buildings[b][f])):
            print(" " + str(buildings[b][f][r]), end="")
        print()

Submission status: Accepted

Solution code:
#
# 6c
#


def main():
    A = [[[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())
        A[b-1][f-1][r-1] += v
    for i in range(4):
        for j in range(3):
            print(" ", end="")
            print(*A[i][j])
        if i < 3:
            print("#" * 20)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
inputs = [list(map(int, input().split())) for _ in range(n)]
values = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for i in inputs:
    values[i[0]-1][i[1]-1][i[2]-1] += i[3]
for b in range(4):
    for f in range(3):
        print(' ', end='')
        print(*values[b][f])
    if b != 3:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
residents = [0]*4*3*10
#list[0-29]:第1棟  list[30-59]:第2棟  list[60-89]:第3棟  list[90-119]:第4棟
#list[0-9]:第1棟一階  list[10-19]:第1棟二階  list[20-29]:第1棟三階
for i in range(n):
  info = list(map(int, input().split()))
  room_num = (info[0]-1)*30 + (info[1]-1)*10 + info[2] -1
  residents[room_num] += info[3]

for i in range(4):
  for j in range(3):
    for k in range(10):
      room_num = i*30 + j*10 + k
      print('',residents[room_num],end='')
    print('')
  if i != 3:
    print('####################')

Submission status: Accepted

Solution code:
N=int(input())
W=[[[0]*10 for _ in range(3)]for _ in range(4)]
for i in range(N):
    bil,col,row,e=map(int,input().split())
    W[bil-1][col-1][row-1]+=e
for k in range(4):
  if k!=0:
    print("#"*20)
  for u in range(3):
    for j in range(10):
      print(f" {W[k][u][j]}",end="")
      if j==9:
        print()

Submission status: Accepted

Solution code:
n=int(input())
A=[[int(0)]*10 for i in range(3)]
B=[[int(0)]*10 for i in range(3)]
C=[[int(0)]*10 for i in range(3)]
D=[[int(0)]*10 for i in range(3)]

for i in range(n):
  b,f,r,v=(int(x) for x in input().split())
  if b==1:
    A[f-1][r-1]+=v
  if b==2:
    B[f-1][r-1]+=v
  if b==3:
    C[f-1][r-1]+=v
  if b==4:
    D[f-1][r-1]+=v

for i in range(3):
  for j in range(10):
    print(" ",A[i][j],sep="",end="")
  print("")
print("####################")

for i in range(3):
  for j in range(10):
    print(" ",B[i][j],sep="",end="")
  print("")
print("####################")

for i in range(3):
  for j in range(10):
    print(" ",C[i][j],sep="",end="")
  print("")
print("####################")

for i in range(3):
  for j in range(10):
    print(" ",D[i][j],sep="",end="")
  print("")

Submission status: Accepted

Solution code:

num = int(input())

b1f1list = [0]*10
b1f2list = [0]*10
b1f3list = [0]*10

b2f1list = [0]*10
b2f2list = [0]*10
b2f3list = [0]*10

b3f1list = [0]*10
b3f2list = [0]*10
b3f3list = [0]*10

b4f1list = [0]*10
b4f2list = [0]*10
b4f3list = [0]*10

for i in range(num):
    b,f,r,v = (int(x) for x in input().split())

    if (b == 1):
        if (f == 1):
            b1f1list[r-1] = b1f1list[r-1]+v

        elif (f == 2):
            b1f2list[r-1] = b1f2list[r-1] + v

        elif (f == 3):
            b1f3list[r-1] = b1f3list[r-1] + v


    elif (b == 2):
        if (f == 1):
            b2f1list[r-1] = b2f1list[r-1]+v

        elif (f == 2):
            b2f2list[r-1] = b2f2list[r-1] + v

        elif (f == 3):
            b2f3list[r-1] = b2f3list[r-1] + v

    elif (b == 3):
        if (f == 1):
            b3f1list[r-1] = b3f1list[r-1]+v

        elif (f == 2):
            b3f2list[r-1] = b3f2list[r-1] + v

        elif (f == 3):
            b3f3list[r-1] = b3f3list[r-1] + v

    elif (b == 4):
        if (f == 1):
            b4f1list[r-1] = b4f1list[r-1]+v

        elif (f == 2):
            b4f2list[r-1] = b4f2list[r-1] + v

        elif (f == 3):
            b4f3list[r-1] = b4f3list[r-1] + v


for i in range(10) :
    print(" "+str(b1f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b1f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b1f3list[i]), end = "")
print("")
print("#"*20)

for i in range(10) :
    print(" "+str(b2f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b2f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b2f3list[i]), end = "")
print("")
print("#"*20)

for i in range(10) :
    print(" "+str(b3f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b3f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b3f3list[i]), end = "")
print("")
print("#"*20)

for i in range(10) :
    print(" "+str(b4f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b4f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b4f3list[i]), end = "")
print("")

Submission status: Accepted

Solution code:
rooms = [[[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 = list(map(int, input().split()))
    rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        print(' ', end='')
        print(*[rooms[i][j][k] for k in range(10)])
    if i != 3:    
        print('#' * 20)

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:
list = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]

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

temp = 0
for building in list:
    if not temp == 0:
        print('#'*20)
    temp += 1
    for floor in building:
        for room in floor:
            print(f' {room}', end='')
        print()

Submission status: Accepted

Solution code:
bldg=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n=int(input())
for i in range(n):
    var=input()
    var=var.split()
    b=int(var[0])-1
    f=int(var[1])-1
    r=int(var[2])-1
    v=int(var[3])
    bldg[b][f][r]+=v
count=0
for building in bldg:
    for floor in building:
        for room in floor:
            print(" "+str(room),end='')
        print()
    if(count==3):
        break
    print("####################")
    count+=1

Submission status: Accepted

Solution code:
N = int(input())
lst = [[0]*10 for _ in range(12)]
for i in range(N):
    a,b,c,d = map(int,input().split())
    lst[3*(a-1)+b-1][c-1] += d
for j in range(12):
    if j in [3,6,9]:
        print("####################")
    print(" ", end = "")
    print(*lst[j])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=int(input())
info=[list(map(int,input().split(" ")))for i in range(num)]
control=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in info:
    control[i[0]-1][i[1]-1][i[2]-1]+=i[3]

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

Submission status: Accepted

Solution code:
FLOORS = 3
ROOMS = 10
SEPARATOR = "####################"


def generate_empty_building():
    return [[0 for _ in range(ROOMS)] for _ in range(FLOORS)]


def output_building(single_building):
    for floor in single_building:
        print(" " + " ".join(str(room) for room in floor))


building_one = generate_empty_building()
building_two = generate_empty_building()
building_three = generate_empty_building()
building_four = generate_empty_building()

notices = int(input())

for _ in range(notices):
    building_num, floor_num, room_num, people = [int(x) for x in input().split()]

    if building_num == 1:
        building_one[floor_num - 1][room_num - 1] += people
    if building_num == 2:
        building_two[floor_num - 1][room_num - 1] += people
    if building_num == 3:
        building_three[floor_num - 1][room_num - 1] += people
    if building_num == 4:
        building_four[floor_num - 1][room_num - 1] += people

buildings = [building_one, building_two, building_three, building_four]

i = 0

for building in buildings:
    i += 1
    output_building(building)
    if i < 4:
        print(SEPARATOR)

Submission status: Accepted

Solution code:
n = int(input())
i = 0
hins = []
while i < n:
    hin = list(map(int, input().split()))
    hins.append(hin)
    i += 1

a = [[0 for i in range(10)] for i in range(3)]
b = [[0 for i in range(10)] for i in range(3)]
c = [[0 for i in range(10)] for i in range(3)]
d = [[0 for i in range(10)] for i in range(3)]

for i in range(n):
    hin = hins[i]
    #print(hin)
    tou = str(hin[0] - 1)
    kai = hin[1] - 1
    hey = hin[2] - 1
    nin = hin[3]
    #print(tou, kai, hey, nin)

    if tou == "0":
        a[kai][hey] = a[kai][hey] + nin
    elif tou == "1":
        b[kai][hey] = b[kai][hey] + nin
    elif tou == "2":
        c[kai][hey] = c[kai][hey] + nin
    elif tou == "3":
        d[kai][hey] = d[kai][hey] + nin
aida = "#" * 20

for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(a[i][j]))
        else:
            print(" {}" .format(a[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(b[i][j]))
        else:
            print(" {}" .format(b[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(c[i][j]))
        else:
            print(" {}" .format(c[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(d[i][j]))
        else:
            print(" {}" .format(d[i][j]), end="")

Submission status: Accepted

Solution code:
n = int(input())
room = [[[0]*10 for i in range(3)]for j in range(4)]
for i in range(n):
    a,b,c,d=map(int,input().split())
    room[a-1][b-1][c-1]+=d

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

Submission status: Accepted

Solution code:
aparts = {
    '1': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '2': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '3': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    '4': [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
}

# n = 3
# arr = [
#     '1 1 3 8',
#     '3 2 2 7',
#     '4 3 8 1 ']
n = int(input())
for i in range(n):
    # b, f, r, v = arr[i].split()
    b, f, r, v = input().split()
    aparts[b][int(f)-1][int(r)-1] += int(v)

for key, values in aparts.items():
    for value in values:
        print(' '+' '.join(list(map(str, value))))
    if key != '4':
        print(f'{"#"*20}')

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, *B = map(int, open(0).read().split())
buildings = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for i in range(0, len(B), 4):
    b = B[i]
    h = B[i+1]
    w = B[i+2]
    v = B[i+3]
    buildings[b-1][h-1][w-1] += v
for i, b in enumerate(buildings):
    for r in b:
        print(" " + " ".join(map(str, r)))
    if i != 3:
        print("####################")

Submission status: Accepted

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

for k in range(4):
    for j in range(3):
        print(" "+" ".join([str(x) for x in build[k][j]]))
    if k!=3:
        print("#"*20)

Submission status: Accepted

Solution code:
residence = [0 for i in range(120)]
n = int(input())
count = 0
while count < n:
    b, f, r, v = map(int, input().split())
    residence[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
    count += 1
for i in range(120):
    if i != 0:
        if i % 10 == 0:
            print()
        if i % 30 == 0:
            print("#" * 20)  
    if i % 10 < 10:
        print(end=" ")
    print(residence[i], end="")
print()

Submission status: Accepted

Solution code:
rooms = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = [int(x) for x in input().split()]
    rooms[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {rooms[i][j][k]}",end='')
        print("")
    if i < 3:
        print("####################")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
house = [[[0*10 for i in range(10)] for j in range(3)] for k in range(4)]

for x 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("", house[i][j][k], end="")
        print()
    if i < 3:
        print("#" * 20)

Submission status: Accepted

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

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())

    for j in range(len(li)):
        for k in range(len(li[j])):
            for m in range(len(li[j][k])):
                if j == b-1 and k == f-1 and m == r-1:
                    li[b-1][f-1][r-1] += v

for i in range(len(li)):
    for f in li[i]:
        for r in f:
            print(" {}".format(r), end="")
        print("")
    if i != len(li)-1:
        print("#" * 20)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = [[0]*10 for i in range(12)]
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    ans[(b-1)*3+f-1][r-1] += v
for i in range(0,12):
    if i%3 == 0 and i > 0:
        print('#'*20)
    print('',' '.join(map(str,ans[i][:])))