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

for c in range(4):
    for d in range(3):
        print('',*room[c][d])
    if c != 3:
        print('#' *20)

Submission status: Accepted

Solution code:
#テーブル初期化　0入れ
table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

#データ数
N = int(input())

#テープルにデータを追加
for loop in range(N):
    building,floor,room,value = map(int,input().split())
    table[building-1][floor-1][room-1] += value

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())
l=[]
for i in range(n):
	b,f,r,v=[int(x) for x in input().split()]
	l.append([b,f,r,v])


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

#input
for i in l:
	b,f,r,v=i[0],i[1],i[2],i[3]
	count[b-1][f-1][r-1] += v


for s,m in enumerate(count):
	for n in m:
		for o in n:
			print(f" {o}",end="")
		print()
	if s<3:
		print("####################")

Submission status: Accepted

Solution code:

        
        
class Building:
    def __init__(self,max_floor,max_room):
        self.max_floor=max_floor
        self.max_room=max_room
        #[floor][room]で管理
        row=max_floor
        col=max_room
        self.room_info=[[0 for j in range(col)] for i in range(row)]
        
    def update_visited(self,f,r,v):
        self.room_info[f][r]+=v
        

class OfficialHouse:
    def __init__(self,max_building=4,max_floor=3,max_room=10):
        self.buildings=[]
        for building_id in range(max_building):
            self.buildings.append(Building(max_floor=max_floor,max_room=max_room))
            
    def update_visited(self,notice):
        
        #indexずれの修正
        b=notice.building_id-1
        f=notice.floor-1
        r=notice.room_number-1
        v=notice.visited_number
        self.buildings[b].update_visited(f,r,v)
        

    def print_official_house_info(self):
        b_max=len(self.buildings)
        f_max=self.buildings[0].max_floor
        r_max=self.buildings[0].max_room
        
        for b in range(b_max):
            for f in range(f_max):
                for r in range(r_max):
                    v=self.buildings[b].room_info[f][r]
                    print(f" {v}",end="")
                print("")
            if b != b_max-1:
                print("####################")
        

class Notice:
    def __init__(self,building_id,floor,room_number,visited_number):
        self.building_id=building_id
        self.floor=floor
        self.room_number=room_number
        self.visited_number=visited_number


def tell_notice(notice_list,house):
    for notice in notice_list:
        house.update_visited(notice)


def input_notice():
    n=int(input())
    
    notice_list=[]
    
    for i in range(n):
        b,f,r,v=tuple(map(int,input().split()))
    
        notice=Notice(building_id=b,floor=f,room_number=r,visited_number=v)
        
        notice_list.append(notice)

        
    return notice_list
    
    
def exe_notice():
    notice_ls=input_notice()
    
    house=OfficialHouse()
    
    tell_notice(notice_ls,house)
    
    house.print_official_house_info()



exe_notice()

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:
building = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
x = [list(map(int,input().split())) for _ in range(n)]

for i in range(len(x)):
    b = x[i][0]-1
    f = x[i][1]-1
    r = x[i][2]-1
    v = x[i][3]
    building[b][f][r] += v

for i in range(4):
    for i2 in range(3):
        print(' '+' '.join(map(str,building[i][i2])))
    if i < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
count=[[[0 for k in range(10)] for j in range(3)] for i in range(4)]
n=int(input())
for elem in range(n):
    b,f,r,v=map(int,input().split())
    count[b-1][f-1][r-1]+=v
    
for i in range(4):
    if i>0:
        print("#"*20)
    for j in range(3):
        for k in range(10):
            print(" %d"%(count[i][j][k]),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 = 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(' '.join(map(str, rooms[i][j])))
    if i < 3:
        print('#' * 20)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

house = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(n):
    a = input()
    b, f, r, v = map(int, a.split())
    house[b - 1][f - 1][r - 1] += v
    if house[b - 1][f - 1][r -1] < 0:
        house[b - 1][f-1][r-1] = 0
    elif house[b - 1][f-1][r-1] >= 10:
        house[b - 1][f-1][r-1] = 9


for i in range(len(house)):
    for j in house[i]:
        word=''
        for k in range(10):
            word += ' ' + str(j[k])
        print(word)
    if i + 1 == len(house):
        pass
    else:
        print('#' * 20)

Submission status: Accepted

Solution code:
n=int(input())

A = [[[0] * 10 for i in range(3)] for j in range(4)]

cnt = 1

while cnt <= n:
    b,f,r,v = map(int, input().split())
    A[b-1][f-1][r-1] += v
    cnt += 1

for bb in range(4):
    for ff in range(3):
        for rr in range(10):
            print(" {}".format(A[bb][ff][rr]), end="")
        print("")
    if bb != 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
n=int(input())

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


for i, b in enumerate(room):
    for f in b:
        for r in f:
            print(" {}".format(r),end="")
        print()
    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:
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:
l=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
n=int(input())
for i in range(n):
    a,b,c,d=input().split()
    l[int(a)-1][int(b)-1][int(c)-1]+=int(d)
for i in range(120):
    print('',l[i//30][i%30//10][i%10],end='')
    if (i+1)%10==0:print()
    if (i+1)%30==0 and i!=119:print('#'*20)

Submission status: Accepted

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

for i in range(4): # b
    for j in range(3): # f
        print("", " ".join(map(str, status[i][j])))
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
build = []
each1 = []
each2 = []
each3 = []
each4 = []


for i in range(30):
    each1.append(0)
    each2.append(0)
    each3.append(0)
    each4.append(0)

build.append(each1)
build.append(each2)
build.append(each3)
build.append(each4)


n = int(input())

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


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

Submission status: Accepted

Solution code:
BUILDINGS = 4
FLOORS = 3
ROOMS = 10

house = [[[0] * ROOMS for i in range(FLOORS)] for j in range(BUILDINGS)]
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 b in range(BUILDINGS):
    for f in range(FLOORS):
        for r in range(ROOMS):
            print(' ', house[b][f][r], sep='', end='')
        print()
    if b < BUILDINGS - 1:
        print('#'*20)

Submission status: Accepted

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

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

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

Submission status: Accepted

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


n = int(input())

for i in range(n):
    i, j, k, v = map(int, input().split())
    mantion[i - 1][j - 1][k - 1] += v

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

Submission status: Accepted

Solution code:
bld = [0] * 4

for i in range(4):
  bld[i] = [0] * 3
  for j in range(3):
    bld[i][j] = [0] * 10
    
n = int(input())
list = [input() for i in range(n) ]

for i in list:
    b, f, r, v = map(int, i.split())
    bld[b - 1][f - 1][r - 1] += v

count = 0
for i in bld:
    for j in i:
      print(' ', end='')
      print(*j)
    if count < 3:
      print('####################')
    count += 1

Submission status: Accepted

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

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

for i in rooms:
    for j in i:
        for k in j:
            print(' %d'%k, end='')
        print()
    x += 1
    if x < 4:
        print('#' * 20)

Submission status: Accepted

Solution code:
data_list = [[["0" for i in range(10)] for j in range(3)] for x in range(4)]
number = int(input())

for x in range(number):

    b ,f ,r, v =(int(i) for i in input().split())
    data = data_list[b -1] [f -1][r -1]
    point =int(data) + v
    data_list[b -1] [f -1][r -1] = str(point)
for n in range(4):
    for y in range(3):
        
        for l in range(10):
            print(' ' + data_list[n][y][l], end="")
        print()
    if n < 3:
       
        print('#' * 20)

Submission status: Accepted

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

n = int(input())
for N in range(n):
    b,f,r,v = map(int, input().split())
    buildings[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(" " + str(buildings[i][j][k]), end="")
        print()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
all_list = []
for i in range(12):
    a = [0] * 10
    all_list.append(a)

n = int(input())
num_list = []

for i in range(n):
    b, f, r, v = map(int, input().split())
    
    if b == 1:
        all_list[f-1][r-1] += v
    elif b == 2:
        all_list[f+2][r-1] += v
    elif b == 3:
        all_list[f+5][r-1] += v
    elif b == 4:
        all_list[f+8][r-1] += v
 
tmp = 0   
for i in all_list:
    print(" ", end="")
    print(*i)
    tmp +=1
    if tmp  == 3 or tmp == 6 or tmp == 9:
        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) :
    if i > 0 :
        print("#"*20)
    for j in range(3) :
        for k in range(10) :
            print(" ", end = "")
            print(count[i][j][k], end = "")
        print()

Submission status: Accepted

Solution code:
N = int(input())
room = [[[0 for j in range(10)] for i in range(3)] for k in range(4)]
s = "####################"

for i in range(N):
    b,f,r,v = [int(i) for i in 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 = "")
            if k == 9:
                print()
    if i != 3:
        print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
info = [[int(arg) for arg in input().split()] for _ in range(n)]
data = [[0]*10 for _ in range(3*4)]
for i in info:
    b, f, r, v = i
    data[3*(b-1)+f-1][r-1] += v

for i, d in enumerate(data):
    if i != 0 and i % 3 == 0:
        print('#'*20)
    print(' ' + ' '.join([str(i) for i in d]))

Submission status: Accepted

Solution code:
info = int(input())
all = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

for _ in range(info):
    build, floor, room, num = map(int, input().split())
    all[build - 1][floor - 1][room - 1] += num
    
def show_building(arr, sep):
    for floor in arr:
        print("", " ".join(map(str, floor)))
        
    if sep:
        print("#" * 20)
        

for build in range(len(all)):
    show_building(all[build], build != 3)

Submission status: Accepted

Solution code:
n=int(input())
mansion=[[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    b, f, r, v=(int(x) for x in input().split())
    b=b-1
    f=f-1
    r=r-1
    mansion[b][f][r]=mansion[b][f][r]+v
for i in range(4):
    for j in range(3):
        for k in range(10):
            if(k!=9):
                print(" "+str(mansion[i][j][k]), end="")
            else:
                print(" "+str(mansion[i][j][k]))
    if(i!=3):
        print("####################")

Submission status: Accepted

Solution code:
def initialize_buiding(building):
    for i in range(3):
        building.append([0 for j in range(10)])

def change_room(floor, row, v, building):
    building[floor-1][row-1] += v

def print_university_building(building):
    for floor in building:
        print(' ', end='')
        print(' '.join(map(str,floor)))

def print_hash():
    for i in range(1, 20):
        print('#',end="")
    print("#")

uni_building1 = []
uni_building2 = []
uni_building3 = []
uni_building4 = []

initialize_buiding(uni_building1)
initialize_buiding(uni_building2)
initialize_buiding(uni_building3)
initialize_buiding(uni_building4)

n = int(input())

for i in range(n):
    b,f,r,v = (int(x) for x in input().split())
    if b == 1:
        change_room(f,r,v,uni_building1)
    elif b == 2:
        change_room(f,r,v,uni_building2)
    elif b == 3:
        change_room(f,r,v,uni_building3)
    elif b == 4:
        change_room(f,r,v,uni_building4)
    else:
        None

print_university_building(uni_building1)
print_hash()
print_university_building(uni_building2)
print_hash()
print_university_building(uni_building3)
print_hash()
print_university_building(uni_building4)

Submission status: Accepted

Solution code:
n = int(input())

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 _ in range(n):
    b,f,r,v = map(int,input().split())
    tmp = kousya[b-1][f-1][r-1]
    kousya[b-1][f-1][r-1] = tmp + v

for index,tou in enumerate(kousya):
    for kai in tou:
        print(' ' + ' '.join(map(str,kai)))
    if index == len(kousya) - 1:
        continue
    else:
        print('####################')

Submission status: Accepted

Solution code:
# 初期化
b_1 = [[0] * 10 for a in range(3)]
b_2 = [[0] * 10 for a in range(3)]
b_3 = [[0] * 10 for a in range(3)]
b_4 = [[0] * 10 for a in range(3)]

n = int(input())
while n != 0:
    b,f,r,v = input().split()
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    if b == 1:
        b_1[f-1][r-1] += v
    if b == 2:
        b_2[f-1][r-1] += v
    if b == 3:
        b_3[f-1][r-1] += v
    if b == 4:
        b_4[f-1][r-1] += v
    n -= 1

for a in b_1:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('#'*20)
for a in b_2:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('#'*20)
for a in b_3:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('#'*20)
for a in b_4:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')

Submission status: Accepted

Solution code:
n=int(input())

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

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

for i in range(3):
    for k in range(10):
        print(' ' + str(s[1][i][k]),end='')
    print()
        
print('#'*20)
for i in range(3):
    for k in range(10):
        print(' ' + str(s[2][i][k]),end='')
    print()
print('#'*20)

for i in range(3):
    for k in range(10):
        print(' ' + str(s[3][i][k]),end='')
    print()

Submission status: Accepted

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

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

for ridge in operate_list[:-1]:
    for floor in ridge:
        for room in floor:
            print(' ', end='')
            print(room, end='')
        print('')
    print('####################')
    
for floor in operate_list[-1]:
    for room in floor:
        print(' ', end='')
        print(room, end='')
    print('')

Submission status: Accepted

Solution code:
n = int(input())
i = 1
a = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
while i <= n:
    b,f,r,v = map(int,input().split())
    if a[b-1][f-1][r-1] + v < 0:
        a[b-1][f-1][r-1] = 0
    elif a[b-1][f-1][r-1] + v > 9:
        a[b-1][f-1][r-1] = 9
    else:
        a[b-1][f-1][r-1] = a[b-1][f-1][r-1] + v
    i+=1
for ridge in range(4):
    for floor in range(3):
        for room in range(10):
            print(" {}".format(a[ridge][floor][room]),end="")
        print()
    if ridge == 3:
        break
    print("####################")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
building = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
line = "####################"
while num > 0:
  b, f, r, v = map(int,input().split())
  building[b-1][f-1][r-1] += v
  num -= 1
for i in range(4):
  for j in range(3):
    building[i][j] = " " + " ".join(map(str,building[i][j]))

for i in range(4):
  [print(j) for j in building[i]]
  if i < 3:
    print(line)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())

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

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

for buildingnum in range(4):
    for floornum in range(3):
        print('',*roomlist[buildingnum][floornum])
    if buildingnum != 3:
        print('#'*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:
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:

count = [[[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())
    count[b-1][f-1][r-1] += v

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

for x in range(4):
  for y in range(3):
    for z in range(10):
      print(" "+str(num[x][y][z]),end = "")
    print("")
  if x == 3:
    break
  else:
    print("####################")

Submission status: Accepted

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

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

for b in range(4):
    for f in range(3):
        for r in range(10):
            print("",dormitory[b][f][r],end='')
        print('')
    if b != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
kousyas = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0, 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 = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    kousyas[b-1][f-1][r-1] += v

for j, kousya in enumerate(kousyas):
    for f in kousya:
        for i, r in enumerate(f):
            if i == 9:
                print(f' {r}')
            else:
                print(f' {r}', end='')
    if j <= 2:
        print('#' * 20)

Submission status: Accepted

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

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

for b in range(4):
    for f in range(3):
        temp_list = []
        for r in range(10):
            temp_list.append(str(whole_list[b][f][r]))
        print(" " + " ".join(temp_list))
    if b>=0 and b<=2:
        print("#"*20)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

t1 = [[0] * 10 for i in range(3)]
t2 = [[0] * 10 for i in range(3)]
t3 = [[0] * 10 for i in range(3)]
t4 = [[0] * 10 for i in range(3)]


def print_t(t):
    for i in t:
        print(" " + " ".join(map(str, i)))


for i in range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        t1[f - 1][r - 1] = t1[f - 1][r - 1] + v
    elif b == 2:
        t2[f - 1][r - 1] = t2[f - 1][r - 1] + v
    elif b == 3:
        t3[f - 1][r - 1] = t3[f - 1][r - 1] + v
    elif b == 4:
        t4[f - 1][r - 1] = t4[f - 1][r - 1] + v

print_t(t1)
print("####################")
print_t(t2)
print("####################")
print_t(t3)
print("####################")
print_t(t4)

Submission status: Accepted

Solution code:
n = int(input())
info = []
Base = []
Result = [['#' for i in range(10)] for k in range(15)]



for ia in range(n):
    val = list(map(int, input().split()))
    info.append(val)


for B in range(1,5):
    for F in range(1,4):
        for R in range(1,11):
            Base.append(list((B, F, R, 0)))

for ib in info:
    b, f, r, v = ib[0], ib[1], ib[2], ib[3]
    for ic in Base:
        if b == ic[0] and f == ic[1] and r == ic[2]:
            ic[3] += v

for ic in Base:
    b1, f1, r1, v1 = ic[0]-1, ic[1]-1, ic[2]-1, ic[3]
    Result[b1*4+f1][r1] = str(v1)
        
for ie, value in enumerate(Result):
    if ie == 3 or ie == 7 or ie == 11:
        print('#'*20, end='\n')
    else:
        print(' ' +' '.join(value),end='\n')

Submission status: Accepted

Solution code:
n=int(input())

count = [[[0 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())
    count[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {count[i][j][k]}',end='')
        print()
    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:
table = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
total = int(input())

for i in range(total):
    B, F, R, V = list(map(int, input().split()))
    table[B - 1][F - 1][R - 1] += V

for i, bldg in enumerate(table):
    if i > 0:
        print("####################")
    for j, flr in enumerate(bldg):
        for k, room in enumerate(flr):
            print(f" {room}", end="")
        print()

Submission status: Accepted

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