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

for i, block in enumerate(total_live_in):
    if i > 0:
        print("#" * 20)
    for floor in block:
        print(" " + " ".join(map(str,floor)))

Submission status: Accepted

Solution code:
def pout(i, j):
    print(" ", end="")
    print(*l[j][i], sep=" ")


l = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
n = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())
l = list()
for i in range(120):
	l.append(0)
for i in range(n):
	b, f, r, v = map(int, input().split())
	l[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
for i in range(4):
	if i >= 1:
		print('#' * 20)
	for j in range(3):
		for k in range(10):
			print(' ', end='')
			print(l[i * 30 + j * 10 + k], 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())
list = [list(map(int, input().split())) for i in range(n)]
section = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
for i in range(n) :
	sec_num = list[i][0]
	floor = list[i][1]
	room_num = list[i][2]
	person = list[i][3]
	#下の式の左辺の3つ目の括弧がだめ
	section[sec_num-1][floor-1][room_num-1] += person

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[0][i][j], end="")
		if j == 9 :
			print("")
print("#"*20)

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[1][i][j], end="")
		if j == 9 :
			print("")
print("#"*20)

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[2][i][j], end="")
		if j == 9 :
			print("")
print("#"*20)

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[3][i][j], end="")
		if j == 9 :
			print("")

Submission status: Accepted

Solution code:
bills = [
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],

]


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

    count = 0
    for bill in bills:
        count += 1
        for floor in bill:
            [print(" {}".format(r), end='') for r in floor]
            print('')
        if count < len(bills):
            print('####################')


resolve()

Submission status: Accepted

Solution code:
n = int(input())
data1 = [[0 for _ in range(10)] for _ in range(3)] # data[i][j] = i+1階、j+1番目の部屋
data2 = [[0 for _ in range(10)] for _ in range(3)]
data3 = [[0 for _ in range(10)] for _ in range(3)]
data4 = [[0 for _ in range(10)] for _ in range(3)]
data_index = [data1, data2, data3, data4]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    data_index[b-1][f-1][r-1] = data_index[b-1][f-1][r-1] + v
for i in range(3):
    for j in range(10):
        print(f' {data1[i][j]}', end='')
    print()
print('####################')
for i in range(3):
    for j in range(10):
        print(f' {data2[i][j]}', end='')
    print()
print('####################')
for i in range(3):
    for j in range(10):
        print(f' {data3[i][j]}', end='')
    print()
print('####################')
for i in range(3):
    for j in range(10):
        print(f' {data4[i][j]}', end='')
    print()

Submission status: Accepted

Solution code:
n=int(input())
l=[[[0 for R in range(10)] for F in range(3)] for B in range(4)]
for N 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],sep='',end='')
        print()
    if i!=3:
        print('#'*20)

Submission status: Accepted

Solution code:
room = []
for i in range(120):
    room.append(0)


n = int(input())
for i in range(n):
    dataset = input().split(" ")
    b = int(dataset[0])
    f = int(dataset[1])
    r = int(dataset[2])
    v = int(dataset[3])

    

    room[(b-1)*30 + (f-1)*10 + r-1] += v
    

for tou in range(4):
    for kai in range(3):
        for heya in range(10):
            print(" %d" % room[(tou)*30 + (kai)*10 + heya], end="")
        print()
    if tou < 3:
        print("####################")

Submission status: Accepted

Solution code:
def ltos(l):
  s=''
  for i in range(len(l)):
    s+=' '
    s+=str(l[i])
    
  print(s)

b1=[[0]*10 for i in range(3)]
b2=[[0]*10 for i in range(3)]
b3=[[0]*10 for i in range(3)]
b4=[[0]*10 for i in range(3)]
b=[b1,b2,b3,b4]

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


for i in range(len(b)):
  for j in range(len(b[i])):
    ltos(b[i][j])
  if i == 3:
    pass
  else:
    print("####################")

Submission status: Accepted

Solution code:
a = [[0 for j in range(10)] for i in range(3)]
b = [[0 for j in range(10)] for i in range(3)]
c = [[0 for j in range(10)] for i in range(3)]
d = [[0 for j in range(10)] for i in range(3)]
building = [a, b, c, d]
N = int(input())
for i in range(N):
    b, f, r, v = map(int, input().split())
    building[b - 1][f - 1][r - 1] += v
for j in range(4):
    for i in range(3):
        print(" " + " ".join(map(str, building[j][i])))

    if j != 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
n = int(input().strip())

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

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

for i in range(4):
    for line in rooms[i]:
        print(" "+" ".join([str(i) for i in line]))
    if i != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
l = []
for i in range(4):
  l.append([])
  for x in range(3):
    l[i].append([0] * 10)
for nn in range(n):
  b, f, r, v = list(map(int, input().split(' ')))
  l[b - 1][f - 1][r - 1] += v
i = 0
for n in l:
  for nn in n:
    for nnn in nn:
      print(' {0}'.format(nnn), end='')
    print('', sep='\n')
  i += 1
  if i == len(l):
    break
  print('####################')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
official_house = [[[0 for _idx3_ in range(10)] for _idx2_ in range(3)] for _idx1_ in range(4)]

for _ in range(num):
    building,floor,room,count = map(int, input().split())
    official_house[building-1][floor-1][room-1] += count

for building in range(4):
    for floor in range(3):
        for room in range(10):
            print(f" {official_house[building][floor][room]}", end="")
        print("")
    if building < 3:
        print("####################")

Submission status: Accepted

Solution code:

i = 0
l = 0
num = 0
a = []
n = int(input())

while i<n:
    a.append(list(map(int, input().split())))
    i += 1

for i in range(4):
    for j in range(3):
        for k in range(10):
            result = False
            l = 0
            num = 0
            while l < n:
                if i + 1 == a[l][0] and j + 1 == a[l][1] and k + 1 == a[l][2]:
                    num += a[l][3]
                l += 1
            
            print(" %s" % num, end="")
            # if result == True:
            #     print(" %s" % a[l][3], end="")
            # else:
            #     print(" 0", end="")
            
            if k == 9:
                print("")

    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
BIG_NUM = 2000000000

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:
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:
import sys
count = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline().strip())

for _ in range(n):
    array = sys.stdin.readline().strip().split(' ')
    b, f, r, v = [int(i) for i in array]
    count[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' %d' % count[b][f][r], end='')
        print()
    if b != 3:
        print('#'*20)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

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

Submission status: Accepted

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

def main():
    n = int(input())
    input_bulding_datas=[]
    input_bulding_datas=[[int(i) for i in input().split()] for _ in range(n)]

    all_buldings=[]
    for i in range(4):
        floors=[]
        buldings=[]
        for j in range(3):
            floors+=[[0]*10]
        buldings+=floors
        all_buldings+=[buldings]

    for input_floor_datas in input_bulding_datas:
            b,f,r,v=input_floor_datas
            all_buldings[b-1][f-1][r-1]+=v

    print_string=""
    for idx,bulding_data in enumerate(all_buldings):
        for floor_data in bulding_data:
            for data in floor_data:
                print_string+=" "+str(data)
            print(print_string)
            print_string=""
        if idx!=3:
            print("####################")



if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
res_list = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 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 i in range(n):
    io_rec = list(map(int, input().split(" ")))
    bld_num = io_rec[0] - 1
    floor_num = io_rec[1] - 1
    room_num = io_rec[2] - 1
    io_headcnt = io_rec[3]
    res_list[bld_num][floor_num][room_num] += io_headcnt


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

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:
rooms = [[[0]*10 for _ in range(3)] for _ in range(4)]

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

for building in range(len(rooms)):
    for floor in rooms[building]:
        str_f = map(lambda s: str(s), floor)
        str_f = " ".join(str_f)
        print("", end = " ")
        print(str_f)
    if building != 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:
n = int(input())

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

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

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

for b in range(4):
    for f in range(3):
        print("", ' '.join(map(str, list[b][f])))
    if b < 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 _ 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())
nums = [list(map(int, input().split())) for _ in range(n)]

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

for num in nums:
    count[num[0] - 1][num[1] - 1][num[2] - 1] += num[3]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
for i in a:
    l[i[0] - 1][i[1] - 1][i[2] - 1] += i[3]
for i in range(len(l)):
    for j in l[i]:
        print(''.join(map(lambda x: ' ' + str(x), j)))
    if 0 <= i <= len(l) - 2:
        print('#' * 20)

Submission status: Accepted

Solution code:
h=[[[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(i) for i in input().split()]
    h[b-1][f-1][r-1] += v

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

Submission status: Accepted

Solution code:
import copy
n = int(input())
list0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
list1 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list2 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list3 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list4 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
for i in range(n):  
  b, f, r, v = list(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
  else:
    list4[f-1][r-1] += v
for j in range(3):
  print(" " + " ".join((list(map(str, list1[j])))))
print("####################")
for j in range(3):
  print(" " +" ".join((list(map(str, list2[j])))))
print("####################")
for j in range(3):
  print(" " + " ".join((list(map(str, list3[j])))))
print("####################")
for j in range(3):
  print(" " + " ".join((list(map(str, list4[j])))))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
B = 4
F = 3
R = 10
dp = [0] * B * F * R

for i in range(N):
    b, f, r, v = [int(n) for n in input().split()]
    dp[(b-1)*F*R+(f-1)*R+(r-1)] += v
for i in range(B):
    for j in range(F):
        print(' ', end='')
        print(*dp[i*F*R+j*R:i*F*R+j*R+R])
    if i<B-1: 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):
    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(f" {l[i][j][k]}", end="")
        print()
    if i != 3:
        print(20*"#")

Submission status: Accepted

Solution code:
all = [[[0]*10 for q in range(3)] for w in range (4)]
a = int(input())
for m in range(a):
    s,d,f,g = map(int, input().split(' '))
    all[s-1][d-1][f-1] = all[s-1][d-1][f-1] + g
for i in range(4):
    for j in range(3):
        for n in range(10):
            print(' ' + str(all[i][j][n]),end='')
        print()
    if i == 0 or i == 1 or i == 2:
        print('####################')

Submission status: Accepted

Solution code:
n = int(input())
a = [0 for i in range(120)]

for i in range(n):
  b,f,r,v = map(int,input().split())
  a[(b-1)*30 + (f-1)*10 + (r-1)] += v
_ = ''
for i in range(4):
  print(_,*a[i*30:i*30+10])
  print(_,*a[i*30+10:i*30+20])
  print(_,*a[i*30+20:i*30+30])
  if i != 3:
    print('####################')

Submission status: Accepted

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

for i, building in enumerate(buildings):
    for floor in building:
        print(" ",end='')
        print(" ".join(map(str,floor)))
    if i != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
# １フロア１０部屋、３階建ての公舎４棟
n_room = 10
n_floor = 3
n_building = 4
room_info = [[[0 for _ in range(n_room)] for _ in range(n_floor)] for _ in range(n_building)]

for _ in range(n):
    # b棟f階のr番目の部屋にv人が追加で入居
    b, f, r, v = map(int, input().split(" "))
    room_info[b - 1][f - 1][r - 1] += v
    
checker = 0
for building_info in room_info:
    if checker != 0:
        print("#" * 20)
    for floor_info in building_info:
        for room_info in floor_info:
            print(f" {room_info}", end="")
        print()
    checker += 1

Submission status: Accepted

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

for i in range(4):
	for j in range(3):
		for k in range(10):
			print(' {}'.format(m[i][j][k]), end='')
		print()
	if i != 3:
		for _ in range(20):print('#', end='')
		print()

Submission status: Accepted

Solution code:
datemax = int(input())
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for l in range(datemax):
    k,j,i,v = [int(x) for x in input().split()]
    count[k - 1][j - 1][i - 1] += v
for k in range(4):
    for j in count[k]:
        print(" "+" ".join([str(x) for x in j]))
    if k != 3:
        print("".join(["#" for x in range(20)]))

Submission status: Accepted

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

x = 0
for b in range(4):
    if x != 0:
        print('#' * 20)
    x += 1
    for f in range(3):
        for r in range(10):
            print(' {}'.format(public_office[b][f][r]), end='')
        print()

Submission status: Accepted

Solution code:
BIG_NUM = 2000000000

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())
to1 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to2 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to3 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to4 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]

tolist = [to1,to2,to3,to4]

for i in range(n):
    to,kai,heya,hito = map(int,input().split(" "))
    tolist[to-1][kai-1][heya-1] += hito

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

Submission status: Accepted

Solution code:
n = int(input())
tran = [list(map(int, input().split())) for i in range(n)]
house_list = [[[0] * 10 for i in range(3)] for j in range(4)]

for x in range(n):
    b = tran[x][0] - 1
    f = tran[x][1] - 1
    r = tran[x][2] - 1
    house_list[b][f][r] += tran[x][3]

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

Submission status: Accepted

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

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

for s, k in enumerate(tbl):
    for j in k:
        for i in j:
            print(f' {i}', end='')
        print()
    if s == len(tbl)-1:
        continue
    print('####################')

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=map(int,input().split())
    data[b-1][f-1][r-1]+=v
for b in range(4):
    for f in data[b]:
        print("",*f)
    if b != 3:
        print("#"*20)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
bfr = [[[0] * 10 for _ in range(3)] for _ in range(4)]
sep = '#' * 20

n = int(input())

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

for i, b in enumerate(bfr):
    for f in b:
        for r in f:
            print(f' {r}', end='')
        print()
    if i != 3:
        print(sep)
    
# print()

Submission status: Accepted

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

n = int(input())

efrv = [map(int, input().split()) for _ in range(n)]
e, f, r, v = [list(i) for i in zip(*efrv)]

for num in range(n):
    if e[num] == 1:
        a[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 2:
        b[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 3:
        c[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 4:
        d[f[num]-1][r[num]-1] += v[num]


for fl in a:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in b:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in c:
    print(" ",end="")
    print(*fl)
print("#" * 20)
for fl in d:
    print(" ",end="")
    print(*fl)

Submission status: Accepted

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

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

for b in range(4):
    if b > 0 and b < 4:
        print("#"*20)
    for f in range(3):
        line = ""
        for r in range(10):
            v = buildings[b][f][r]
            line += " " + str(v)
        print(line)

Submission status: Accepted

Solution code:
N = int(input())
rooms = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]

for i in range(N):
  b,f,r,v = map(int,input().split())
  rooms[b-1][f-1][r-1] += v
  if rooms[b-1][f-1][r-1] < 0:
    rooms[b-1][f-1][r-1] = 0
  elif rooms[b-1][f-1][r-1] > 9:
    rooms[b-1][f-1][r-1] = 9
  
for i in range(4):
  for j in range(3):
    for k in range(10):
    
        if k == 0:
          print(" "+ str(rooms[i][j][k]),end =" ") 
        elif k == 9:
          print(rooms[i][j][k],end ="")
        else:
          print(rooms[i][j][k],end =" ")  
    
    print()
  if i != 3:
    print("####################")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    s = [
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,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 i in range(n):
        a,b,c,f = map(int, input().split())
        if 0 <= s[a-1][b-1][c-1] + f <=9:
            s[a-1][b-1][c-1] += f
        
    for i in range(4):
        for k in range(3):
            print(" ", end="")
            print(*s[i][k])
        if i != 3:
            print("#"*20)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

b1 = [[0] * 10 for i in range(3)]
b2 = [[0] * 10 for i in range(3)]
b3 = [[0] * 10 for i in range(3)]
b4 = [[0] * 10 for i in range(3)]

cnt = 0

FF =[b1,b2,b3,b4]

for i in range(n):
    b,f,r,v = map(int,input().split())
    if b == 1:
        b1[f-1][r-1] += v
    elif b == 2:
        b2[f-1][r-1] += v
    elif b == 3:
        b3[f-1][r-1] += v
    else:
        b4[f-1][r-1] += v
for k in FF:
    for i in range(3):
        for j in range(10):
            print("",k[i][j],end="")
        print()
    if cnt < 3:
        print('#'*20)
        cnt += 1