-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6095_6096.py
69 lines (66 loc) · 1.43 KB
/
6095_6096.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 6095
d = []
for i in range(20):
d.append([])
for j in range(20):
d[i].append(0)
n = int(input())
for i in range(n):
x, y = input().split()
d[int(x)][int(y)] = 1
for i in range(1, 20):
for j in range(1, 20):
print(d[i][j], end=' ')
print()
li = [[0 for i in range(19)] for j in range(19)]
n = int(input())
for i in range(n):
x, y = map(int, input().split())
if(li[x-1][y-1] != 1):
li[x-1][y-1] = 1
for i in li:
print(' '.join(map(str, i)))
# 6096
d = []
for i in range(20):
d.append([])
for j in range(20):
d[i].append(0)
for i in range(19):
a = input().split()
for j in range(19):
d[i+1][j+1] = int(a[j])
n = int(input())
for i in range(n):
x, y = input().split()
x = int(x)
y = int(y)
for j in range(1, 20):
if d[j][y] == 0:
d[j][y] = 1
else:
d[j][y] = 0
if d[x][j] == 0:
d[x][j] = 1
else:
d[x][j] = 0
for i in range(1, 20):
for j in range(1, 20):
print(d[i][j], end=' ')
print()
li = []
for i in range(19):
li.append([])
k = input().split()
for e in k:
li[i].append(int(e))
n = int(input())
x = []
y = []
for i in range(n):
a, b = map(int, input().split())
for j in range(19):
li[a-1][j] = 1 if li[a-1][j] != 1 else 0
li[j][b-1] = 1 if li[j][b-1] != 1 else 0
for i in li:
print(' '.join(map(str, i)))