-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathccc_s2_2021.py
47 lines (39 loc) · 1.22 KB
/
ccc_s2_2021.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
m = input('')
n = input('')
k = input('')
brush_instructions = []
for i in range(0, int(k)):
the_input = input('')
brush_instructions.append(the_input.split())
art_array = []
for i in range(0, int(m)):
art_array.append([])
for i in art_array:
for s in range(0, int(n)):
i.append("B")
for i in brush_instructions:
if i[0] == "R":
art_array_row = art_array[int(i[1]) - 1]
for index, value in enumerate(art_array_row):
if value == "B":
art_array_row.pop(index)
art_array_row.insert(index, "G")
elif value == "G":
art_array_row.pop(index)
art_array_row.insert(index, "B")
elif i[0] == "C":
for s in art_array:
for index, value in enumerate(s):
if index == int(i[1]) - 1:
if value == "B":
s.pop(index)
s.insert(index, "G")
elif value == "G":
s.pop(index)
s.insert(index, "B")
gold_count = 0
for i in art_array:
for k in i:
if k == "G":
gold_count += 1
print(gold_count)