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:
_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_3=[]
_4_1=[]
_4_2=[]
_4_3=[]
for i in range(10):
    _1_1.append(0)
    _1_2.append(0)
    _1_3.append(0)
    _2_1.append(0)
    _2_2.append(0)
    _2_3.append(0)
    _3_1.append(0)
    _3_2.append(0)
    _3_3.append(0)
    _4_1.append(0)
    _4_2.append(0)
    _4_3.append(0)
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in s:
    bfrv.append(i.split())
for i in bfrv:
    if int(i[0])==1 and int(i[1])==1:
        _1_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==3:
        _4_3[int(i[2])-1]+=int(i[3])
print("",*_1_1)
print("",*_1_2)
print("",*_1_3)
print("#"*20)
print("",*_2_1)
print("",*_2_2)
print("",*_2_3)
print("#"*20)
print("",*_3_1)
print("",*_3_2)
print("",*_3_3)
print("#"*20)
print("",*_4_1)
print("",*_4_2)
print("",*_4_3)

Submission status: Accepted

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

for i in range(4):
  for j in range(3):
    print(' '+' '.join(map(str, cnt[i][j])))

  if i != 3:
    print('#'*20)

Submission status: Accepted

Solution code:
_, *lines = open(0).readlines()
H = [[[0]*10 for i in range(3)] for j in range(4)]
for line in lines:
    b, f, r, v = map(int, line.split())
    H[b-1][f-1][r-1] += v
for i, h in enumerate(H):
    if i:
        print("#"*20)
    for r in h:
        print("",*r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

rooms = [[[0] * 10 for _ in range(3)] for _ in range(4)]
stdin.readline().rstrip()
while True:
    try:
        b, f, r, v = [int(x) for x in stdin.readline().rstrip().split()]
        rooms[b-1][f-1][r-1] += v
    except:
        break

for b in range(4):
    for f in range(3):
        print(" ", end = "")
        print(*rooms[b][f])
    else:
        if b != 3:
            print("#"*20)

Submission status: Accepted

Solution code:
residents = [[[0] * 11 for i in range(4)] for j in range(5)]
N = int(input())
for _i in range(N):
    b, f, r, v = map(int, input().split())
    residents[b][f][r] += v
for i in range(1, 5):
    for j in range(1, 4):
        print(' ' + ' '.join(map(str, residents[i][j][1:])))
    if not i == 4:
        print(''.join(['#'] * 20))

Submission status: Accepted

Solution code:
A = []
for _ in range(12):
	A.append([0]*10)

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

for i in range(12):        
	print(' ', end='')
	print(' '.join(map(str, A[i])))
	if i in [2, 5, 8]:
		print('#'*20)

Submission status: Accepted

Solution code:
sharpNum = 20
roomNum = 10
height = 15
dataNum = int(input())
#building = [[0]*sharpNum] * height
building = [[0] * sharpNum for i in range(height)]

for data in range(dataNum):
    actBuilding = 1
    actRoom = 0
    actFloor = 0
    b,f,r,v = map(int, input().split())
    for floor in range(height):
        actRoom = 0
        if floor%4 == 3:
            actFloor = 0
            actBuilding = actBuilding + 1
            for room in range(sharpNum):
                building[floor][room] = "#"
        else:
            actFloor = actFloor + 1
            
            for room in range(sharpNum):
                if room%2 == 0:
                    building[floor][room] = " "
                else:
                    actRoom = actRoom + 1 
                    if actBuilding == b and actFloor== f and actRoom == r:
                        building[floor][room] = building[floor][room] + v

for floor in range(height):      
    for i in range(len(building[0])):
        print(building[floor][i],end="")
    print("")

Submission status: Accepted

Solution code:
n= int(input())
table=[[[0]*10 for i in range(0,3)]for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    table[b-1][f-1][r-1] +=v
x=0
for i in range(4):
    if x !=0:
        print("#"*20)
    x =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())
lst=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    lst[b-1][f-1][r-1] +=v
x=0
for i in range (4):
    if x!=0: print("#"*20)
    x+=1
    for a in range(3):
        for b in range(10):
            print(" %d"%(lst[i][a][b]),end="")
        print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = ["#"*20 if i%4==0 else "0"*10 for i in range(1, 16)]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    h = 4*b-(4-f)-1
    li[h] = li[h].replace(li[h], ''.join([str(int(list(li[h])[r-1])+v) if i == r-1 else list(li[h])[i] for i in range(10)]))
li = [' '+' '.join(li[i]) if (i+1)%4!=0 else li[i] for i in range(len(li))]
print('\n'.join(li))

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 y in range(4):

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

Submission status: Accepted

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

for i in range(int(input())):
	n=list(map(int,input().split()))
	room[n[0]-1][n[1]-1][n[2]-1]+=n[3]
n=0
for i in room:
	for j in i:
		print(' '+' '.join(list(map(str,j))))
		if n==2 or n==5or n==8:
			print('####################')
		n+=1

Submission status: Accepted

Solution code:
num = {
    1:{1:[0]*10,2:[0]*10,3:[0]*10},
    2:{1:[0]*10,2:[0]*10,3:[0]*10},
    3:{1:[0]*10,2:[0]*10,3:[0]*10},
    4:{1:[0]*10,2:[0]*10,3:[0]*10}
}

n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    num[b][f][r-1] += v
for b in num:
    for f in num[b]:
        for r in num[b][f]:
            print(' '+str(r), end='')
        print()
    if b==4: break
    print('#'*20)

Submission status: Accepted

Solution code:
rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    a,b,c,d = map(int, input().split())
    rooms[a-1][b-1][c-1] += d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(rooms[i][j][k]), end = "")
        print()
    if i != 3:
        print("####################")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

i = 0
while i < n:
    b,f,r,v = (int(x) for x in input().split())
    
    table[b-1][f-1][r-1] += v

    i += 1

for i,elem_i in enumerate(table):           # building
    for j,elem_j in enumerate(elem_i):      # floor
        for k, elem_k in enumerate(elem_j): # room
            print (" " + str(elem_k), end='')
        print ("")
    if i != 3:
        print ("####################")

Submission status: Accepted

Solution code:
table = [0] * 4*3*10

n = int(input())

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

for i in range(120):
    if i != 0 and i % 30 == 0:
        print("####################")
    print(" %d" % table[i], end="")
    if i%10 == 9:
        print()

Submission status: Accepted

Solution code:
n = int(input())
a = []

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

Submission status: Accepted

Solution code:

num = int(input())

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

for i in range(num):
	#b棟 f階 r番目 v人
	b,f,r,v = map(int,input().split(" "))
	list2[b-1][f-1][r-1] += v

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

Submission status: Accepted

Solution code:
n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] += v
for i, v in enumerate(A, 1):
    print(' ' + ' '.join([str(p) for p in v]))
    if i == 3 or i == 6 or i == 9:
        print('####################')

Submission status: Accepted

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

    buildings[b-1][f-1][r-1] += v
sep = 1
for b in buildings:
    for f in b:
        print(" ",end="")
        print(*f)
    if sep != len(buildings):
        print("#" * 20)
        sep +=1

Submission status: Accepted

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

    buildings[b-1][f-1][r-1] += v
sep_count = len(buildings) - 1
for b in buildings:
    for f in b:
        print(" ",end="")
        print(*f)
    if sep_count != 0:
        print("#" * 20)
        sep_count -= 1

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())
record=[[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for i in range(n):
    b,f,r,v = [int(x) for x in input().split()]
    record[b-1][f-1][r-1]+=v
for b in range(4):
    for f in record[b]: print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("".join(["#" for x in range(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:
#ITP1_6_C
A=[[[0 for k in range(10)]for j in range(3)]for i in range(4)]
format(A)
n=int(input())
for m in range(n):
  b,f,r,v=map(int,input().split())
  S=A[b-1][f-1][r-1]+v
  A[b-1][f-1][r-1]=S
for i in range(4):
  for j in range(3):
    for k in range(10):
      print ("",A[i][j][k],end='')
    print("")
  if i<3:
    print("####################")

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


b_list=[]
f_list=[]
r_list=[]
v_list=[]
while n > 0:
  b, f, r, v = map(int, input().split())
  b_list.append(b)
  f_list.append(f)
  r_list.append(r)
  v_list.append(v)
  n = n-1

for (blist,flist,rlist,vlist) in zip(b_list,f_list,r_list,v_list):
  count[blist-1][flist-1][rlist-1] = count[blist-1][flist-1][rlist-1] + vlist

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

Submission status: Accepted

Solution code:
# ITP1_6_C
# Array - Official House
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C&lang=jp
from sys import stdin

n = int(stdin.readline().rstrip())

NUMBER_OF_BUILDING = 4
FLOORS_PER_BUILDING = 3
ROOMS_PER_FLOOR = 10

official_house = [
    [
        [
            0 for _ in range(ROOMS_PER_FLOOR)
            ] for _ in range(FLOORS_PER_BUILDING)
        ] for _ in range(NUMBER_OF_BUILDING)
    ]

for cnt in range(n):
    b, f, r, v = (int(n) for n in stdin.readline().rstrip().split())
    official_house[b - 1][f - 1][r - 1] += v

for no, building in enumerate(official_house):
    if no != 0:
        print("#" * 20)

    for floor in building:
        print(" " + " ".join(map(str, floor)))

Submission status: Accepted

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

while(i < inf):
    b,f,r,v = map(int,input().split())
    b -=1
    f -=1
    r -=1
    buil[b][f][r] += v
    if buil[b][f][r] > 9: buil[b][f][r] = 9
    elif buil[b][f][r] < 0: buil[b][f][r] = 0
    i += 1

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

Submission status: Accepted

Solution code:
count =[[[0]*10 for j in range(3)] for k in range(4)]
n = int(input())
for x in range(n):
    b,f,r,v = map(int,input().split())
    # 1 <= b <=4
    # 1 <= f <= 3
    # 1 <= r <= 10
    # 1 <= v <= 9
    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(f' {count[i][j][k]}',end="")
        print()

Submission status: Accepted

Solution code:
n = int(input())

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

x = 0

for i in range(4):
  if x!=0:
    print('#'*20)
  x += 1
  
  for b in range(3):
    for f in range(10):
      print(' %d'%(num[i][b][f]), end ='')
    print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
d = {}
for i in range(n):
  [b, f, r, v] = list(map(int,input().split()))
  key = f'{b} {f} {r}'
  if key in d:
    d[key] += v
  else:
    d[key] = v
    
for b in range(1,5):
  for f in range(1,4):
    for r in range(1,11):
      key = f'{b} {f} {r}'
      if key in d:
        print(" "+str(d[key]),end="")
      else:
        print(" "+str(0),end="")
      if r == 10:
        print()
      if r == 10 and f == 3 and b != 4:
        print('####################')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def az17():
    a = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
    n = input()
    for i in range(n):
        xs = map(int,raw_input().split())
        a[xs[0]-1][xs[1]-1][xs[2]-1] = a[xs[0]-1][xs[1]-1][xs[2]-1] + xs[3]
    for b in range(0,4):
        for f in range(0,3):
            print "",
            for r in range(0,10):
                print a[b][f][r],
            print
        if not b == 3:
            print "#"*20

az17()

Submission status: Accepted

Solution code:
n = int(raw_input())

D = []
for i in range(0,4):
    bb = []
    for k in range(0,3):
        b = [0,0,0,0,0,0,0,0,0,0]
        bb.append(b)
    D.append(bb)

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

for b in range(0,4):
    for f in range(0,3):
        s = ''
        for r in range(0,10):
            v = str(D[b][f][r])
            s = s + ' ' + v
        print s
    if b < 3:
        print "####################"

Submission status: Accepted

Solution code:
n = int(input())
count = 0
room = [int(0) for i in range(4) for j in range(3) for k in range(10)]
while count < n:
    x = list(map(lambda k: int(k), input().split(" ")))
    room[(x[0]-1)*30+(x[1]-1)*10+(x[2]-1)] += x[3]
    count += 1
for i in range(4):
    if i != 0:
        print("####################")
    for j in range(3):
        for k in range(10):
            print(" %d" % room[30*i+10*j+k], end="")
        print("")

Submission status: Accepted

Solution code:
n=int(raw_input())
buildings=[[[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,raw_input().split())
    buildings[b-1][f-1][r-1]+=v
#print buildings                                                                                                    
for i in range(4):
    for j in range(3):
        ln=''
        for k in range(10):
            ln+=' '+str(buildings[i][j][k])
        print ln
    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)]
s='#'*20
n=input()
for i in range(n):b,f,r,v=map(int,raw_input().split());l[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(-3,0):print ' '+' '.join(map(str,l[i][j]))
    if i<3:print s

Submission status: Accepted

Solution code:
data = []
for i in xrange(4):
	tou = []
	data.append(tou)
	for j in xrange(3):
		kai = [0 for k in xrange(10)]
		tou.append(kai)
n = int(raw_input())
for i in xrange(n):
	b,f,r,v = map(int, raw_input().split(" "))
	data[b-1][f-1][r-1] = max(0, data[b-1][f-1][r-1] + v)
for tou in data:
	if not tou is data[0]:
		print "#" * 20
	for kai in tou:
		print " " + " ".join(map(str, kai))

Submission status: Accepted

Solution code:
n = input()
floor = []
for i in range(n):
    floor.append(map(int,raw_input().split()))

bill = [ [ [ 0 for c in range(10)] for b in range(3)] for a in range(4)]

for a in floor:
    bill[a[0]-1][a[1]-1][a[2]-1] = (bill[a[0]-1][a[1]-1][a[2]-1]) + (a[3])
flg = 0
for a in bill:
    if flg == 1:
        print "####################"
    for b in a:
        print " " + " ".join(map(str,b))
        flg = 1

Submission status: Accepted

Solution code:
n = int(raw_input())

nums = [[[0 for x in range(10)] for x in range(3)] for x in range(4)]

for idx in range(n):

    b, f, r, v  = tuple([int(x) for x in raw_input().split(" ")])
    nums[b-1][f-1][r-1] += v

for i_b in range(4):
    if i_b != 0: print "#"*20
    for i_f in range(3):
        print " " + " ".join([str(x) for x in nums[i_b][i_f]])

Submission status: Accepted

Solution code:
import sys
 
BUILDINGS = tuple(x for x in range(4))
FLOORS = tuple(x for x in range(3))
ROOMS = tuple(x for x in range(10))
 
occupant = [[[0 for r in ROOMS] for f in FLOORS] for b in BUILDINGS]
 
n = input() # 読み捨て
 
for line in sys.stdin:
    b, f, r, v = map(int, line.split())
    occupant[b - 1][f - 1][r - 1] += v
     
for b in BUILDINGS:
    if b:
        print('#' * 20)
    for f in FLOORS:
        print("", *occupant[b][f])

Submission status: Accepted

Solution code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

count = int(input())

for c in range(count):
    (b, f, r, v) = [int(x) for x in input().split()]
    data[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',data[b][f][r], end='')
        print()
    print('#' * 20) if b < 4 - 1 else print(end='')

Submission status: Accepted

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

count = int(input())

for x in range(count):
   (b,f,r,v) = [int(i) for i in input().split()]
   data[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in range(3):
        print(' ',end='')
        for r in range(10):
            if r == 9:
                print(data[b][f][r], end='')
            else:
                print(data[b][f][r], '', end='')
        print()

    if b == 3:
        break
    for x in range(20):
        print('#',end='')
    print()

Submission status: Accepted

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

        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],

        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],

        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
        ]
s = '####################'

n = int(input())
for c in range(n):
    (b,f,r,v) = [int(x) for x in input().split()]
    if 1 > b > 5 and 1 > f > 4 and 1 > r > 10:
        break
    floor[b-1][f-1][r-1] += v

for z in range(4):
    for i in range(len(floor[z])):
        for v in floor[z][i]:
            print(end=' ')
            print(v, end='')
        print()
    if not z == 3:
        print(s)

Submission status: Accepted

Solution code:
floor = [[[0] * 10 for x in range(3)] for y in range(4)]

for c in range(int(input())):
    (b,f,r,v) = [int(x) for x in input().split()]
    if 1 > b > 5 or 1 > f > 4 or 1 > r > 10:
        break
    floor[b-1][f-1][r-1] += v

for x in range(3 * 4):
    if x % 3 == 0 and not x == 0:
        print('#' * 20)
    print('',' '.join(str(y) for y in floor[int(x / 3)][x % 3]))

Submission status: Accepted

Solution code:
floor = [[[0] * 10 for x in range(3)] for y in range(4)]

for c in range(int(input())):
    (b,f,r,v) = [int(x) for x in input().split()]

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

for x in range(3 * 4):
    if x % 3 == 0 and not x == 0:
        print('#' * 20)
    print('',' '.join(str(y) for y in floor[int(x / 3)][x % 3]))

Submission status: Accepted

Solution code:
import sys

n = input()
x = {}

for i in range(1,5):
    for j in range(1,4):
        for k in range(1,11):
            x[(i,j,k)] = 0

for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    x[(b,f,r)] += v

for i in range(1,5):
    for j in range(1,4):
        for k in range(1,11):
            sys.stdout.write(' ')
            sys.stdout.write(str(x[(i,j,k)]))
        print
    if(i != 4):
        for l in range(20):
            sys.stdout.write('#')
        print
exit(0)

Submission status: Accepted

Solution code:
data = [[[0 for r in range(10)] for  f in range(3)] for b in range(4)]

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


for b in range(4):
  for f in range(3):
    for r in range(10):
      print(' {0}'.format(data[b][f][r]), end='')
    print()
  print('#' * 20) if b < 4 - 1 else print(end='')

Submission status: Accepted

Solution code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

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



for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' {0}'.format(data[b][f][r]), end='')
        print()
    print('#' * 20) if b < 4 -1 else print(end='')

Submission status: Accepted

Solution code:
import sys

official_house = {}
for b in range(1, 5):
    for f in range(1, 4):
        for r in range(1, 11):
            official_house[(b, f, r)] = 0

n = int(sys.stdin.readline())
for line in sys.stdin:
    (b, f, r, v) = [int(i) for i in line.split()]
    official_house[(b, f, r)] += v

for b in range(1, 5):
    if b != 1:
        print("####################")
    for f in range(1, 4):
        for r in range(1, 11):
            print(" %d" % official_house[(b, f, r)], end="")
        print()

Submission status: Accepted

Solution code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())

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



for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',data[b][f][r], end='')
        print()
    print('#' * 20) if b < 4 - 1 else print(end='')

Submission status: Accepted

Solution code:


dic = {}
for b in range(1,5):
    for f in range(1,4):
        for r in range(1,11):
            dic[(b,f,r)] = 0

n = int(raw_input())
for k in range(n):
    b,f,r,v = map(int,raw_input().split())
    dic[(b,f,r)] += v

j = 0
for b in range(1,5):
    for f in range(1,4):
        ls = []
        for r in range(1,11):
            ls.append(dic[(b,f,r)])
        print ' ' + ' '.join(map(str,ls))
        
    else:
        if j < 3:
            print '#'*20
        j +=1

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    nums = [[[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 = [int(i) for i in input().split()]
        nums[b-1][f-1][r-1] += v
    for b in range(4):
        for f in range(3):
            print(' ' + ' '.join([str(i) for i in nums[b][f]]))
        if b == 3: break
        print('#'*20)

Submission status: Accepted

Solution code:
#coding:utf-8
#1_6_C 2015.4.5
house = [[[0 for r in range(10)] for f in range(3)] for f in range(4)]

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(4):
    for f in range(3):
        print(' ' + ' '.join(list(map(str,house[b][f]))))
    if b != 3:
        print('#' * 20)

Submission status: Accepted

Solution code:
#coding:utf-8
#1_6_C 2015.4.5
house = [[[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())
    house[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in range(3):
        print(' ' + ' '.join(list(map(str,house[b][f]))))
    if b != 3:
        print('#' * 20)

Submission status: Accepted

Solution code:
l=[0]*120
s="#"*20
for i in range(input()):b,f,r,v=map(int,raw_input().split());l[b*30+f*10+r-41]+=v
print "",
for i in range(120):
 print l[i],;j=i+1
 if j==120:break
 if j%30==0:print;print s,
 if j%10==0:print;print "",