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:
ppl = [[],[],[],[]]
for i in range(4):
    for j in range(3):
        tmp = []
        for k in range(10):
            tmp.append(0)
        ppl[i].append(tmp)
n = int(input())
for i in range(n):
    vals = list(map(int,input().split()))
    ppl[vals[0]-1][vals[1]-1][vals[2]-1] += vals[3]
for i in range(4):
    for j in range(3):
        for k in range(10):
            print (" ", end="")
            print (ppl[i][j][k], end="")
        print ()
    if i != 3:
        for j in range(20):
            print ("#", end="")
        print ()

Submission status: Accepted

Solution code:
# 我ながらリスト作成よくやったと思う
# 逃げずにしっかり多次元リストを使った
n = int(input())
rid1 = [[0] * 10 for i in range(3)]
rid2 = [[0] * 10 for i in range(3)]
rid3 = [[0] * 10 for i in range(3)]
rid4 = [[0] * 10 for i in range(3)]
Ridge = [rid1, rid2, rid3, rid4]
for i in range(n):
    b, f, r, v = input().split()
    b = int(b);  f = int(f);  r = int(r);  v = int(v)
    Ridge[b-1][f-1][r-1] += v

#i,jはオブジェクト型だね
# 問題の要求上ボツ（笑）
# for i in Ridge:
#     for j in i:
#         for k in j:
#             print(" %d" %k, end="")
#         print()
#     print("#" * 20)

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

Submission status: Accepted

Solution code:
def main():
	n = int(input())
	d = {}
	for _ in range(n):
		b, f, r, v = map(int, input().split())
		d[(b,f,r)] = d.get((b,f,r),0) + v
	for i in range(1, 5):
		for j in range(1, 4):
			for k in range(1, 11):
				print(' ', d.get((i,j,k), 0), sep='', end='')
			print()
		if i < 4:
			print('####################')

main()

Submission status: Accepted

Solution code:
room = [[[],[],[]],[[],[],[]],[[],[],[]],[[],[],[]]]
for i in range(4):
    for j in range(3):
        for k in range(10):
            room[i][j].append(0)
n = int(input())
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):
        print(" "+" ".join(map(str, room[i][j])))
    if i != 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 h in range(n):
 b,f,r,v=map(int,input().split())
 house[b-1][f-1][r-1]=house[b-1][f-1][r-1]+v

for a in range(4):
    for b in range(3):
        for c in range(10):
            print(' ',house[a][b][c],sep='',end='')
        print('',sep='')
    
    if a == 3:
        n=0
    else:
        for d in range(20):
            print('#',sep='',end='')
        print('',sep='')

Submission status: Accepted

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

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

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"%(apartment[i][a][b]),end = "")
        print()

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] += 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('####################',end='\n')

Submission status: Accepted

Solution code:
n = int(input())
A1 = [[0 for i in range(10)] for j in range(3)]
A2 = [[0 for i in range(10)] for j in range(3)]
A3 = [[0 for i in range(10)] for j in range(3)]
A4 = [[0 for i in range(10)] for j in range(3)]
for i in range(n):
  b, f, r, v = map(int,input().split())
  if b == 1:
    A1[f-1][r-1] = A1[f-1][r-1] + v
  if b == 2:
    A2[f-1][r-1] = A2[f-1][r-1] + v
  if b == 3:
    A3[f-1][r-1] = A3[f-1][r-1] + v
  if b == 4:
    A4[f-1][r-1] = A4[f-1][r-1] + v

for i in range(3):
  print('',' '.join(map(str, A1[i])))
print('#' * 20)
for i in range(3):
  print('',' '.join(map(str, A2[i])))
print('#' * 20)
for i in range(3):
  print('',' '.join(map(str, A3[i])))
print('#' * 20)  
for i in range(3):
  print('',' '.join(map(str, A4[i])))

Submission status: Accepted

Solution code:
room1=[[0 for i in range(10)]for j in range(3)]
room2=[[0 for i in range(10)]for j in range(3)]
room3=[[0 for i in range(10)]for j in range(3)]
room4=[[0 for i in range(10)]for j in range(3)]

n=int(input())
for i in range(n):
    b,f,r,v=map(int,input().split())
    if b==1:
        room1[f-1][r-1]+=v
    elif b==2:
        room2[f-1][r-1]+=v
    elif b==3:
        room3[f-1][r-1]+=v
    elif b==4:
        room4[f-1][r-1]+=v

for i in range(3):
    print(" ",end='')
    print(*room1[i])
print("#"*20)
for i in range(3):
    print(" ",end='')
    print(*room2[i])
print("#"*20)
for i in range(3):
    print(" ",end='')
    print(*room3[i])
print("#"*20)
for i in range(3):
    print(" ",end='')
    print(*room4[i])

Submission status: Accepted

Solution code:
d = {}
n = int(input())
for i in range(n):
    *bfr, v = map(int, input().split())
    d[tuple(bfr)] = d.get(tuple(bfr), 0) + v


for b in range(1, 5):
    for f in range(1, 4):
        for r in range(1, 11):
            print(f' {d.get((b, f, r), 0)}', end='')
        print()
    if b != 4:
        print('#' * 20)

Submission status: Accepted

Solution code:
a = int(input())
case = 0
# r = 部屋数　f = 階数　ｂ　＝　棟数 
list1 = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

for i in range(a):
    x = input()
    c = x.split()
    list1[int(c[0])-1][int(c[1])-1][int(c[2])-1] += int(c[3])

aa ="{:2}"*10
q = "#"*20
for b in range(4):
    for f in range(3):
        print(aa.format(*list1[b][f]))
    if b != 3:
        print(q)

Submission status: Accepted

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

for j in range(4):
    if j != 0:
        print('#'*20)
    for k in range(3):
        print('',' '.join(map(str,room[j][k])))

Submission status: Accepted

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



for k in range(4):
	for j in range(3):
		for i in range(10):
			print(f' {tbl[k][j][i]}',end="")
		print()
	if k<3:	
		print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
a = [0]*120
for i in range(n):
    b, f, r, v = map(int, input().split())
    t = (b - 1) * 30 + (f - 1) * 10 + r - 1
    a[t] += v
for i in range(120):
    print(' %d'  % a[i], end="")
    if i % 10 == 9:
        print("")
    if i % 30 == 29 and i < 100:
        for c in range(20):
            print("#", end="")
        print("")

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 x in range(n):
    a,b,c,d=map(int,input().split())
    house[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
M={}
l=0
for i in range(4):
    for j in range(3):
        for k in range(10):
            M[(i+1,j+1,k+1)]=0
 
while l<n:
    L=input().split( )
    b=int(L[0])
    f=int(L[1])
    r=int(L[2])
    v=int(L[3])
    M[(b,f,r)]=M[(b,f,r)]+v
    l+=1
 
 
for i in range(4):
    for j in range(3):
        for k in range(10):
            print (f" {M[(i+1,j+1,k+1)]}",end="")
        print()
    if i<3:
        print("####################")

Submission status: Accepted

Solution code:

room = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

#print(room)

N = int(input())

for loop in range(N):

    b, f, r, v = map(int, input().split())

    room[b-1][f-1][r-1] += v

    #print(room)

for i in range(0,4):
    for j in range(0,3):
        for k in range(0,10):
            print(" %d"%room[i][j][k],end = "")
        print("")
    if i < 3:
        print("#"*20)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

for b, build in enumerate(data):
    for floor in build:
        for i, man in enumerate(floor):
            if i == 9:
                print(" {}".format(man))
            else:
                print(" {}".format(man), end="")
    if b != 3:
        print("####################")

Submission status: Accepted

Solution code:
n=int(input())
M={}
l=0
for i in range(4):
    for j in range(3):
        for k in range(10):
            M[(i+1,j+1,k+1)]=0

while l<n:
    L=input().split( )
    b=int(L[0])
    f=int(L[1])
    r=int(L[2])
    v=int(L[3])
    M[(b,f,r)]=M[(b,f,r)]+v
    l+=1


for i in range(4):
    for j in range(3):
        for k in range(10):
            print (f" {M[(i+1,j+1,k+1)]}",end="")
        print()
    if i<3:
        print("####################")
# ####が一度多かった

Submission status: Accepted

Solution code:
# DEFINE
LENGTH_1 = 10
LENGTH_2 = 3
LENGTH_3 = 4

list_3d = [[[0 for i in range(LENGTH_1)] for j in range(LENGTH_2)] for k in range(LENGTH_3)]


# INPUT
n = int(input())

for _ in range(n):

    b, f, r, v = map(int, input().split())

    list_3d[b - 1][f - 1][r - 1] += v


# OUTPUT
for k in range(LENGTH_3):
    for j in range(LENGTH_2):
        for i in range(LENGTH_1):
            print(f" {list_3d[k][j][i]}", end="")
        print()

    if k != LENGTH_3 - 1:
        print("#" * 20)

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

Submission status: Accepted

Solution code:
list = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())

for i in range(n):
    data = input().split()
    list[int(data[0])-1][int(data[1])-1][int(data[2])-1] += int(data[3])

for b in range(4):
    for f in range(3):
        for r in range(10):
            print(f" {list[b][f][r]}", end="")
        print()
    if b < 3:
        print("####################")

Submission status: Accepted

Solution code:
data = [[[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 = map(int, input().split())
    data[b - 1][f - 1][r - 1] += v
for index, tower in enumerate(data):
    for floor in tower:
        print(' ' + ' '.join(map(str, floor)))
    if index != 3:
        print('####################')

Submission status: Accepted

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

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

a = 1
for i in info:
    for j in i:
        print(" ", end="")
        print(*j)
    if 4 > a:
        print("####################")
    a = a + 1

Submission status: Accepted

Solution code:
n=int(input())
 
field=[[0 for i in range(20)]for j in range(15)]
 
for i in range(n):
   
    b,f,r,v=map(int,input().split())
    h=(b-1)*4+f-1
    w=r*2-1
    n=v
    field[h][w]+=n
     
for y in range(15):
   
    for x in range(20):
       
        if(y%4==3):field[y][x]='#'
        elif x%2==0 :field[y][x]=' '
        print(field[y][x],end='')
     
    print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

field=[[0 for i in range(20)]for j in range(15)]

for i in range(n):
  
    b,f,r,v=map(int,input().split())
    h=(b-1)*4+f-1
    w=r*2-1
    n=v
    field[h][w]+=n
    
for y in range(15):
  
    for x in range(20):
      
        if(y%4==3):field[y][x]='#'
        elif x%2==0 :field[y][x]=' '
        print(field[y][x],end='')
    
    print()

Submission status: Accepted

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

for i in range(4):
   for j in range(3):
       print(' ', end='')
       print(*tou[i][j])
   if i!=3: print('#'*20)

Submission status: Accepted

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

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

for i, b in enumerate(rooms):
    for f in b:
        print(' ' + ' '.join([str(i) for i in f]))
    if i < len(rooms) - 1:
        print('#' * 20)

Submission status: Accepted

Solution code:
# ITP1_6_C
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):
    b, f, r, v = map(int, input().split())
    count[b-1][f-1][r-1] +=  v

for k in range(4):
    if not(ｋ == 0):
        print("####################")
    for j in range(3):
        for i in range(10):
            print(" %d"%(count[k][j][i]), end="")
        print()

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:
n = int(input())
home = [[0 for i in range(20)] for j in range(15)]  #横最大20→間の#,縦最大3階*4棟+3行の空行
for i in range(n) :
 b, f, r, v = map(int, input().split())
 h = (b - 1) * 4 + f - 1
 w = r * 2 - 1
 s = v
 home[h][w] += s
for y in range(15) :
 for x in range(20) :
   if(y % 4 == 3) :
     home[y][x] = "#"
   elif(x % 2 == 0) :
     home[y][x] = " "
   print(home[y][x], end = "")
 print()

Submission status: Accepted

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

x=0
for i in range(4):
  if x!=0:
    print("#"*20)
  for a in range(3):
    for b in range(10):
      print(" {:d}".format(rooms[i][a][b]),end="")
    print()
  x=x+1

Submission status: Accepted

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

N = int(input())
hensu = []
for x in range(N):
    room = [int(e) for e in input().split()]
    ROOM[room[0]-1][room[1]-1][room[2]-1] += room[3]
    
for y in range(len(ROOM)):
    for z in range(len(ROOM[y])):
        print(" " + " ".join(map(str, ROOM[y][z])))
    if y==3:
        break
    else:
        print("####################")

Submission status: Accepted

Solution code:
###
### atcorder test program
###

### math class
class math:
    ### pi
    pi = 3.14159265358979323846264338

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

math = math()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

A = [[0,0,0,0,0,0,0,0,0,0] for i in range(3)]
B = [[0,0,0,0,0,0,0,0,0,0] for i in range(3)]
C = [[0,0,0,0,0,0,0,0,0,0] for i in range(3)]
D = [[0,0,0,0,0,0,0,0,0,0] for i in range(3)]

N = int(input())

for i in range(N):
    inlist = [int(w) for w in input().split()]
    if inlist[0] == 1:
        A[inlist[1]-1][inlist[2]-1] += inlist[3]
    elif inlist[0] == 2:
        B[inlist[1]-1][inlist[2]-1] += inlist[3]
    elif inlist[0] == 3:
        C[inlist[1]-1][inlist[2]-1] += inlist[3]
    elif inlist[0] == 4:
        D[inlist[1]-1][inlist[2]-1] += inlist[3]

for i, array in enumerate([A, B, C, D]):
    for j in array:
        output.list(j)
    if i != 3:
        print("####################")

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):
    b, f, r, v = map(int,input().split())
    count[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("%d"%(count[i][j][k]),end="")
        else:
            print()
    else:
        if i < 3:
            print("####################")

Submission status: Accepted

Solution code:
inCount = int(input())
publicBuilds = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for i in range(inCount):
    b, f, r, v = map(int, input().split())
    publicBuilds[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, publicBuilds[b][f])))
        if f > 1 and b < 3:
            print("#" * 20)

Submission status: Accepted

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


    
for i in range(len(houses)):
    if(i!=0):
        print("####################")
    for j in range(len(houses[i])):
        print(" ",end="")
        print(" ".join(map(str,houses[i][j])))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# set building
b_num = 4
f_num = 3
r_num = 10
building = [[[0 for i in range(r_num)] for j in range(f_num)] for k in range(b_num)]

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

# output
for b_tmp in range(b_num):
    for f_tmp in range(f_num):
        for r_tmp in range(r_num):
            print(' '+str(building[b_tmp][f_tmp][r_tmp]), end='')
        print('')
    if b_tmp < b_num-1:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())

comp1 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp2 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp3 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp4 = [[0, 0, 0, 0, 0, 0, 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 range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        comp1[f - 1][r - 1] += v
    elif b == 2:
        comp2[f - 1][r - 1] += v
    elif b == 3:
        comp3[f - 1][r - 1] += v
    else:
        comp4[f - 1][r - 1] += v

for s in comp1:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('#' * 20)
for s in comp2:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('#' * 20)
for s in comp3:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('#' * 20)
for s in comp4:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))

Submission status: Accepted

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" %d"%Mantion[i][j][k],end="")
        print()
    if i != 3:
        print('#'*20)

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=[int(j) for j in input().split()]
    a[b-1][f-1][r-1] += v
for i, b in enumerate(a):
    for f in b:
        for r in f:
            print(" {}".format(r),end="")
        print()
    if i< 3:
        print("#"*20)

Submission status: Accepted

Solution code:
import sys
next(sys.stdin)
m = [[[0]*10 for _ in range(3)] for _ in range(4)]
for l in sys.stdin:
    b,f,r,v = map(int, l.split())
    m[b-1][f-1][r-1] += v
for i,b in enumerate(m):
    if i: print('#'*20)
    for f in b: print('',*f)

Submission status: Accepted

Solution code:
#棟ごとにリストを分けてみる
heya1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya4 = [0, 0, 0, 0, 0, 0, 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の入力
n = int(input())

#繰り返し処理
for i in range(n):
    x = input()
    list = x.split()
    [b, f, r, v] = list
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    
    #部屋番号の確認
    f = f - 1
    f = f * 10
    fr = f + r
    fr = fr - 1
    
    ####棟ごとにいじるリストを分ける
    if b == 1:
        heya = heya1[fr]
        heya = int(heya)
        heya = heya + v
        heya1[fr] = heya
    
    elif b == 2:
        heya = heya2[fr]
        heya = int(heya)
        heya = heya + v
        heya2[fr] = heya
    
    elif b == 3:
        heya = heya3[fr]
        heya = int(heya)
        heya = heya + v
        heya3[fr] = heya

    elif b == 4:
        heya = heya4[fr]
        heya = int(heya)
        heya = heya + v
        heya4[fr] = heya

#それぞれのリストを文字列に変換
heya1 = [str(n) for n in heya1]
heya2 = [str(n) for n in heya2]
heya3 = [str(n) for n in heya3]
heya4 = [str(n) for n in heya4]

#表示行ごとに分ける
heya11 = heya1[0:10]
heya12 = heya1[10:20]
heya13 = heya1[20:30]

heya21 = heya2[0:10]
heya22 = heya2[10:20]
heya23 = heya2[20:30]

heya31 = heya3[0:10]
heya32 = heya3[10:20]
heya33 = heya3[20:30]

heya41 = heya4[0:10]
heya42 = heya4[10:20]
heya43 = heya4[20:30]

#表示フォーマットを定める
heya11 = " " + " ".join(heya11)
heya12 = " " + " ".join(heya12)
heya13 = " " + " ".join(heya13)
heya21 = " " + " ".join(heya21)
heya22 = " " + " ".join(heya22)
heya23 = " " + " ".join(heya23)
heya31 = " " + " ".join(heya31)
heya32 = " " + " ".join(heya32)
heya33 = " " + " ".join(heya33)
heya41 = " " + " ".join(heya41)
heya42 = " " + " ".join(heya42)
heya43 = " " + " ".join(heya43)

#1行ごとに表示させてみる。
print(heya11)
print(heya12)
print(heya13)
print("####################")
print(heya21)
print(heya22)
print(heya23)
print("####################")
print(heya31)
print(heya32)
print(heya33)
print("####################")
print(heya41)
print(heya42)
print(heya43)

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
for j in c:
    for k in j:
        print('', *k)
    i += 1
    if 0 < i < 4:
        print('####################')

Submission status: Accepted

Solution code:
#! python3
# officeHouse.py - 4棟あるオフィスの入居者情報を管理します

# 入居棟を配列でモデル化する
four_buildings = [[[0]*10 for i in range(3)] for j in range(4)] # 1F 10 部屋、4棟

# 棟の間の仕切りを作る
partition = '#' * 20

# 入力される入居者情報の数を受け取る
n = int(input())

# 入居者情報の数分だけ、ループを回し、モデルに反映する
for info in range(n):
  regident_info = [int(i) for i in input().split()]
  b = regident_info[0] - 1 # ビル python の配列は 0 スタートのため
  f = regident_info[1] - 1 # 階
  r = regident_info[2] - 1 # 部屋
  v = regident_info[3] # 人数
  four_buildings[b][f][r] += v

# ここから出力
for i, building in enumerate(four_buildings):
  for floor in building:
    str_floor = list(map(str, floor))
    print(' ' + ' '.join(str_floor))
  if i != 3:
    print(partition)

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):
    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 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())

list1 = [[0 for k in range(10)] for l in range(3)]
list2 = [[0 for k in range(10)] for l in range(3)]
list3 = [[0 for k in range(10)] for l in range(3)]
list4 = [[0 for k in range(10)] for l in range(3)]


for i in range(n):
    b,f,r,v = map(int,input().split())
    if b == 1:
        list1[f-1][r-1] += v
    elif b == 2:
        list2[f-1][r-1] += v        
    elif b == 3:
        list3[f-1][r-1] += v        
    elif b == 4:
        list4[f-1][r-1] += v

for i in range(3):
    for j in range(10):
        print(' {0}'.format(list1[i][j]),end='')
    print()

print('####################')
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list2[i][j]),end='')
    print()    

print('####################')
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list3[i][j]),end='')
    print()

print('####################')
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list4[i][j]),end='')
    print()

Submission status: Accepted

Solution code:
floor = []

for i in range(120):
    floor.append(0)

n = int(input())

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print("", str(floor[30 * (i - 1) + 10 * (j - 1) + (k - 1)]),end="")
        print("")
    if i < 3:
        print("#" * 20)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    house_id,floor,room,add=map(int,input().split())
    table[house_id-1][floor-1][room-1]+=add
    
for i in range(4):
    if i!=0:
        print("#"*20)
    
    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end="")
        print()

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 loop in range(N):
    house_id,floor,room,add = map(int,input().split())
    table[house_id-1][floor-1][room-1] += add

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

Submission status: Accepted

Solution code:
l = [[[0]*10 for _ in range(3)]for _ in range(4)]
for _ in range(int(input())):
    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):
        print(" " + " ".join(map(str,l[i][j])))
    if i != 3:
        print("#"*20)

Submission status: Accepted

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

N = int(input())

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

for i, building in enumerate(counts):
    for floar in building:
        for room in floar:
            print(" " + str(room), end = "")
        print()
    if i < 3:
        print("#"*20)