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:
hm=[[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']]]
ku=['#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#']
n=int(input())
for w in range(n):
    a,b,c,d=input().split()
    a=int(a)
    b=int(b)
    c=int(c)
    e=int(hm[a-1][b-1][c-1])
    hm[a-1][b-1][c-1]=str(e+int(d))
    
for i in range(4):
    for m in range(3):
        print("",' '.join(hm[i][m]))
    if i==3:
        break
    print(''.join(ku))

Submission status: Accepted

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

n = int(input())
for i in range(n):
    b, f, r, v = [int(j) for j in input().split()]
    rooms[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print(" " + " ".join([str(i) for i in rooms[b][f]]), end="")
        print()
    if b < 3:
        print("#" * 20)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
info_n = int(input())

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

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

    resident[b - 1][f - 1][r - 1] += v
    
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(" " + str(resident[b][f][r]), end="")
        print()
    if b != 3:
        print("####################")

Submission status: Accepted

Solution code:

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

def enter_room(building_index, floor_index, room_index, num):
    room[building_index][floor_index][room_index] += num

N = int(input())

for i in range(N):
    building_num, floor_num, room_num, num = list(map(int, input().split()))
    enter_room(building_num - 1, floor_num - 1, room_num - 1, num)

for b in range(len(room)):
    for f in range(len(room[b])):
        line = ''
        for r in range(len(room[b][f])):
            line += ' ' + str(room[b][f][r])
        print(line)
    if b < len(room) - 1:
        print('####################')

Submission status: Accepted

Solution code:
n=int(input())
a=[map(int,raw_input().split()) for i in range(n)]
bd_lists=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for b in a:
    if bd_lists[b[0]-1][b[1]-1][b[2]-1]+b[3]>=0:
        bd_lists[b[0]-1][b[1]-1][b[2]-1]+=b[3]
for i in range(4):
    for j in range(3):
        ln=""
        for k in range(10):
            ln+=" "+str(bd_lists[i][j][k])
        print ln
    if i!=3:
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
# b棟f階のr番目の部屋にv人が追加で入居した
bfrv = [list(map(int, input().split())) for i in range(n)]
rooms = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for b,f,r,v in bfrv: rooms[b-1][f-1][r-1] += v
for b in range(4):
  for f in range(3):
    print(" "+" ".join(map(str, rooms[b][f])))
  if b<3: print("#"*20)

Submission status: Accepted

Solution code:
#4x3x10の配列を作りすべての要素を０にする
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("",count[i][j][k],end="")
        print()
    if i < 3:
        print("####################")

Submission status: Accepted

Solution code:
n = int(input())
house = [[[0] * 10 for i in range(3)] for j in range(4)]
count = 0
while count != n:
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v
    count += 1
for b_num in range(4):
    for f_num in range(3):
        for r_num in range(10):
            print(" " + str(house[b_num][f_num][r_num]),end="")
        print()
    if b_num != 3: 
        print("#" * 20)

Submission status: Accepted

Solution code:
n = int(input())
list = [[0]*10 for i in range(12)]
for j in range(n):
    b,f,r,v = map(int,input().split())
    list[(b-1)*3+f-1][r-1] += v
for k in range(12):
    print("",*list[k])
    if k%3 == 2 and k <= 10 :print("#"*20)

Submission status: Accepted

Solution code:
def show_building_information( notice ):
    building_num = 4
    floor_num = 3
    room_num = 10

    information = [0 for a in range(building_num * floor_num * room_num)]

    for n in notice:
        information[ (n[0] - 1 ) * floor_num * room_num + (n[1] - 1) * room_num + (n[2] - 1) ] +=  n[3]


    for b in range(building_num) :
        for f in range(floor_num):
            for r in range(room_num):
                print( " " + str( information[ b * floor_num * room_num + f * room_num + r ] ), end="")

            print()

        if b != building_num - 1:
            print("####################")
        else:
            print("", end="")


if __name__ == "__main__":

    n  = int(input())
    notice_list = list()

   

    while( n > 0 ):

        notice = input().split(" ")
        notice_list.append([int(notice[0]), int(notice[1]), int(notice[2]), int(notice[3])])

        n = n - 1

    # dummy = [
    # [1, 1, 3, 8],
    # [3, 2, 2, 7],
    # [4, 3, 8, 1],
    # ]

    show_building_information(notice_list)

Submission status: Accepted

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

x = int(input())
for i in range(x):
    T = list(map(int,input().split()))
    Floa[T[0]-1][T[1]-1][T[2]-1] += T[3]

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' %d' %Floa[i][j][k],end = '')
        print()
    if i < 3:
        print('####################')

Submission status: Accepted

Solution code:
#make the building table
table = [[[0]*10 for i in range(0,3)] for k in range(0,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

x=0

for j in range(4):
    if x!=0:
        print('#'*20)
    x +=1
    
    for k in range(3):
        for m in range(10):
            print(" %d"%(table[j][k][m]), end = "")
        print()

Submission status: Accepted

Solution code:
n = int(input())
a = [[[0 for vv in range(10)] for ff in range(3)] for bb in range(4)]
hl = "#"*20
for i in range(n):
    b, f, r, v = map(int,input().split())
    a[b-1][f-1][r-1] += v
line = ""
for bb in range(4):
    for ff in range(3):
        for rr in range(10):
            line += " " + str(a[bb][ff][rr])
        print(line)
        line = ""
    if bb != 3:
        print(hl)

Submission status: Accepted

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

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


for _ 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:
n = int(input())


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


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

Submission status: Accepted

Solution code:
tbl = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
line = "#" * 20

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

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

Submission status: Accepted

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


number_of_data = int(input())

for k in range(number_of_data):
    info = list(map(int, input().split(" ")))
    building1[info[0] - 1][info[1] - 1][info[2] - 1] += info[3]

for m in range(4):
    for floor in range(3):
        for room in range(10):
            if room != 9:
                print(" " + str(building1[m][floor][room]), end="")
            else:
                print(" " + str(building1[m][floor][room]))
    if m != 3:
        print("#" * 20)

Submission status: Accepted

Solution code:

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

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

sw_First=True
for l_b in l_school:
    if sw_First==True:
        sw_First=False
    else:
        print("####################")
    for l_r in l_b:
        print("",*l_r)

Submission status: Accepted

Solution code:
def splitsharp():
    print("#"*20)

num = int(input())
building = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(num):
    infos = [int(e) for e in input().split()]
    building[infos[0]-1][infos[1]-1][infos[2]-1] = building[infos[0]-1][infos[1]-1][infos[2]-1] + infos[3]
for i in range(4):
    for j in range(3):
        floor =[]
        s = ""
        for k in range(10):
            floor.append(" ")
            floor.append(str(building[i][j][k]))
        s = "".join(floor)
        print(s)
    if(i==3):
        exit()
    splitsharp()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import copy
floor = [0,0,0,0,0,0,0,0,0,0]
build = [copy.deepcopy(floor),copy.deepcopy(floor),copy.deepcopy(floor)]
list = [copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build)]

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

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

Submission status: Accepted

Solution code:
class Room:
  def __init__(self):
    self.__count = 0
  
  @property
  def count(self):
      return self.__count

  @count.setter
  def count(self, count):
      self.__count += count

class Floor:
  def __init__(self):
    self.__rooms = [Room() for i in range(10)]
  
  def room(self, i):
    return self.__rooms[i - 1]
  
  @property
  def get(self):
    return ' ' + ' '.join([str(self.__rooms[i].count) for i in range(10)])

class Building:
  def __init__(self):
    self.__floors = [Floor() for i in range(3)]
  
  def floor(self, i):
    return self.__floors[i - 1]
  
  @property
  def get(self):
    return '\n'.join([self.__floors[i].get for i in range(3)])

class School:
  def __init__(self):
    self.__buildings = [Building() for i in range(4)]
  
  def building(self, i):
    return self.__buildings[i - 1]
  
  @property
  def get(self):
    delimiter = '\n' + '#' * 20 + '\n'
    return delimiter.join([self.__buildings[i].get for i in range(4)])

if __name__ == '__main__':
  school = School()
  for i in range(int(input())):
     b, f, r, v = map(int, input().split())
     school.building(b).floor(f).room(r).count = v
  print(school.get)

Submission status: Accepted

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

num = int(input())
for _ in range(num):
    aRoom = input().split()
    rooms[int(aRoom[0])-1][int(aRoom[1])-1][int(aRoom[2])-1] = int(aRoom[3]) + rooms[int(aRoom[0])-1][int(aRoom[1])-1][int(aRoom[2])-1]

for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' ',end="")
            print(int(rooms[b][f][r]),end="")
        print()
    if b <= 2:
        print("####################")

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 j, row in enumerate(tbl):
    if j != 0:print("#" * 20)
    for k in row:
        print("", *k)

Submission status: Accepted

Solution code:
A = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n, *D = map(int, open(0).read().split())
for b, f, r, d in zip(*[iter(D)]*4):
    A[b-1][f-1][r-1] += d
for i in range(4):
    for j in range(3):
        print(' '+' '.join(map(str, list(A[i][j]))))
    if i + 1 in range(4):
        print('#'*20)

Submission status: Accepted

Solution code:
tenants = []
buildings = [[[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())
    buildings[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(" {}".format(buildings[i][j][k]), end='')
        print()

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    bfr=[[[0]*10 for _ in range(3)]for _ in range(4)]
    for _ in range(n):
        b,f,r,v=map(int,input().split())
        b,f,r=b-1,f-1,r-1
        bfr[b][f][r]+=v
    for i,ff in enumerate(bfr):
        for f in ff:
            print("",*f)
        if i==3:break
        print("####################")

main()

Submission status: Accepted

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

s = ""
for b in range(4):
    for f in range(3):
        for r in range(10):
            s += ' '+str(building[b][f][r])
        s += '\n'
    if b!=3:
        s = s + '#'*20 + '\n'

print(s, end='')

Submission status: Accepted

Solution code:
notify = int(input())
b1 = list()
b2 = list()
b3 = list()
b4 = list()

for f in range(30):
    b1.append(0)
    b2.append(0)
    b3.append(0)
    b4.append(0)
    
whole = list()
whole.append(b1)
whole.append(b2)
whole.append(b3)
whole.append(b4)

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

sh = ''
times = 0
for m in range(20):
    sh += '#'
    
for s in whole:
    ccc = ''
    for p in range(len(s)):
        if p == 10 or p == 20:
            ccc += '\n'
        ccc += ' ' + str(s[p])
    print(ccc)
    if times < 3:
        print(sh)
    times += 1

Submission status: Accepted

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

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

Submission status: Accepted

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

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


count = 0
for floor in building:
    for room in floor:
        for volume in room:
            print(" " + str(volume), end = "")
        print()
    count = count +1
    if count <=3:
        print("#" *20)

Submission status: Accepted

Solution code:
table = [[[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())
    table[b-1][f-1][r-1] += v
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:
houses = [[[0]*10 for f in range(3)] for b in range(4)]

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

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

Submission status: Accepted

Solution code:
n=int(input())
info=[input().split() for i in range(n)]

A=[[['',0,0,0,0,0,0,0,0,0,0] for i in range(3)]for j in range(4)]

for new in info:
    A[int(new[0])-1][int(new[1])-1][int(new[2])]+=int(new[3])

for j in range(4):
    for k in A[j]:
        print(*k)
    if j < 3:print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
#s = [[[0]*10]*3]*4
s =[[[0]*10 for i in range (0,3)] for k in range (0,4)]
n = int(input())
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(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(s[i][j][k]) , end = "")
        print()     
        
    if i < 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
ds=[]
for b in range(4):
    ds.append([])
    for f in range(3):
        ds[b].append([])
        for r in range(10):
            ds[b][f].append(0)
for i in range(n):
    txt=input().split()
    for num,v in enumerate(txt):
        txt[num]=int(v)
    ds[txt[0]-1][txt[1]-1][txt[2]-1]+=txt[3]
for b in range(4):
    if b>=1:
        print('#'*20)
    for f in range(3):
        txt=''
        for r in range(10):
            txt+=' '+str(ds[b][f][r])
        print(txt)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

for i in range(info):
    b, f, r, v = [int(i) for i in input().split()]
    dormitory[b-1][f-1][r-1] += v
    
for i, b in enumerate(dormitory):
    for f in b:
        for r in f:
            print(' '+str(r), end="")
        print()
    if i != 3:
        print('#'*20)

Submission status: Accepted

Solution code:
building1 = [[0] * 10, [0] * 10, [0] * 10]
building2 = [[0] * 10, [0] * 10, [0] * 10]
building3 = [[0] * 10, [0] * 10, [0] * 10]
building4 = [[0] * 10, [0] * 10, [0] * 10]
all_building = [building1, building2, building3, building4]
separator = '#' * 20


def int_decre(str_num):
    return int(str_num) - 1


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

for j in range(4):
    for i in range(3):
        print(' {0[0]} {0[1]} {0[2]} {0[3]} {0[4]} {0[5]} {0[6]} {0[7]} {0[8]} {0[9]}'.format(all_building[j][i]))
    if j == 3:
        pass
    else:
        print(separator)

Submission status: Accepted

Solution code:

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {a[i][j][k]}",end = "")
        print()
    if i < 3:
        print("####################")
    else:
        pass

Submission status: Accepted

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

for i in range(0,len(house)):
    for j in range(0, len(house[i])):
        print(' '+' '.join(map(str,house[i][j])))
    if (i<len(house)-1):
        print('#'*20)

Submission status: Accepted

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

for tou in date:
    for floor in tou:
        for room in floor:
            print("", room, end = "")
        print()
    if t != 3:
        t += 1
        print("####################")

Submission status: Accepted

Solution code:
n = int(input())
one_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
one_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
one_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_three = [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:
        if f == 1:
            one_one[r-1] += v
        elif f == 2:
            one_two[r-1] += v
        elif f == 3:
            one_three[r-1] += v
    if b == 2:
        if f == 1:
            two_one[r-1] += v
        elif f == 2:
            two_two[r-1] += v
        elif f == 3:
            two_three[r-1] += v
    if b == 3:
        if f == 1:
            three_one[r-1] += v
        elif f == 2:
            three_two[r-1] += v
        elif f == 3:
            three_three[r-1] += v
    if b == 4:
        if f == 1:
            four_one[r-1] += v
        elif f == 2:
            four_two[r-1] += v
        elif f == 3:
            four_three[r-1] += v
print(" ",end="")
print(" ".join(map(str, one_one)))
print(" ",end="")
print(" ".join(map(str, one_two)))
print(" ",end="")
print(" ".join(map(str, one_three)))
print("####################")
print(" ",end="")
print(" ".join(map(str, two_one)))
print(" ",end="")
print(" ".join(map(str, two_two)))
print(" ",end="")
print(" ".join(map(str, two_three)))
print("####################")
print(" ",end="")
print(" ".join(map(str, three_one)))
print(" ",end="")
print(" ".join(map(str, three_two)))
print(" ",end="")
print(" ".join(map(str, three_three)))
print("####################")
print(" ",end="")
print(" ".join(map(str, four_one)))
print(" ",end="")
print(" ".join(map(str, four_two)))
print(" ",end="")
print(" ".join(map(str, four_three)))

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())
cnt=0

while True:
    b,f,r,v=list(map(int,input().split()))
    a[b-1][f-1][r-1]+=v
    cnt+=1
    if cnt==n:
        break

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

Submission status: Accepted

Solution code:

n=int(input())

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

for m in range(n):
    house,floor,room,mem=map(int,input().split())
    
    l[house-1][floor-1][room-1]+=mem
    
for o in range(4):
    if o is not 0:
        print("####################")
    for p in range(3):
        for q in range(10):
            print(" %d"%(l[o][p][q]),end = "")
        print()

Submission status: Accepted

Solution code:
count = [[[0 for i in range(11)] for j in range(4)] for k in range(5)]

N = int(input())

for i in range(N):
    b,f,r,v = map(int, input().split())
    count[b][f][r] += v

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

Submission status: Accepted

Solution code:
n = int(input())

buildings = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]

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

for x in range(4):
    for floor in buildings[x]:
        print("", *floor)
    if x != 3:
        print("####################")

Submission status: Accepted

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

for k in range(4):
    for j in range(3):
        for i in range(10):
            print(" {}".format(condos[k][j][i]), end="")
        print()
    if k < 3:
        print("####################")

Submission status: Accepted

Solution code:
def buildmake(building) :
    for i in range(3):
        iroom = str(i) + "room"
        iroom = list()
        for j in range(10):
            iroom.append(0)
        building.append(iroom)
    buildings.append(building)

def showroom(floor):
    roomline = str()
    for s in floor:
        roomline += " " + str(s)
    print(roomline)

buildings = list()
building1 = list()
building2 = list()
building3 = list()
building4 = list()

buildmake(building1)
buildmake(building2)
buildmake(building3)
buildmake(building4)

n = int(input())

for i in range(n):
      b,f,r,v = map(int,input().split())
      buildings[b-1][f-1][r-1] += v
      
buildcount = 0
for building in buildings:
    
    for floor in building:
        showroom(floor)
  
    if buildcount == len(buildings) - 1:
        break
    else:
        buildcount += 1
        print("#"*20)

Submission status: Accepted

Solution code:
people = {}
n = int(input())

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

	people.setdefault(b, {})
	people[b].setdefault(f, {})
	people[b][f].setdefault(r, 0)

	people[b][f][r] += v

for b in range(1, 5):
	for f in range(1, 4):
		for r in range(1, 11):
			if people.get(b):
				if people[b].get(f):
					p = people[b][f][r] if people[b][f].get(r) else 0
				else:
					p = 0
			else:
				p = 0

			print(' {}'.format(p), end='')
		print('\n', end='')
	if b < 4:
		print('#' * 20)

Submission status: Accepted

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

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

for i in range(len(table)):
    for  j in range(len(table[i])):
        for k in range(len(table[i][j])):
            print(' %d' %(table[i][j][k]), end = '')
        print('')
    if i != len(table) - 1:
        print('####################')