-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1244.py
More file actions
37 lines (35 loc) · 1008 Bytes
/
1244.py
File metadata and controls
37 lines (35 loc) · 1008 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
29
30
31
32
33
34
35
36
37
switch=int(input())
statement=input().split()
student=int(input())
for i in range(student):
s=list(map(int,input().split()))
if s[0]==1:
for j in range(s[1]-1,switch,s[1]):
if statement[j]=='1':
statement[j]='0'
else:
statement[j]='1'
else:
x=1
index=s[1]-1
while index-x>=0 and index+x<switch:
if statement[index-x]==statement[index+x]:
if statement[index-x]=='1':
statement[index-x]='0'
statement[index+x]='0'
x+=1
else:
statement[index-x]='1'
statement[index+x]='1'
x+=1
else:
break
if statement[index]=='1':
statement[index]='0'
else:
statement[index]='1'
for i in range(switch):
if i%20==19:
print(statement[i])
else:
print(statement[i],end=" ")