-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1244.py
More file actions
28 lines (27 loc) · 705 Bytes
/
1244.py
File metadata and controls
28 lines (27 loc) · 705 Bytes
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
def change(num):
if switch[num] == 0:
switch[num] = 1
else:
switch[num] = 0
return
N = int(input())
switch = [-1] + list(map(int, input().split()))
students = int(input())
for _ in range(students):
sex, num = map(int, input().split())
if sex == 1:
for i in range(num, N + 1, num):
change(i)
else:
change(num)
for k in range(N // 2):
if num + k > N or num - k < 1: break
if switch[num + k] == switch[num - k]:
change(num + k)
change(num - k)
else:
break
for i in range(1, N + 1):
print(switch[i], end=" ")
if i % 20 == 0:
print()