Yevhenii Mianovskyi

 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
# generating random points and zeros array
import random
data = [[5000, 500000]]
array = []
bombs = 0
while bombs < data[0][1]:
item = [random.randint(0,4999) for i in range(2)]
data.append(item)
bombs += 1
# initializing zeros vectors
rows = [0 for i in range(5000)]
cols = [0 for i in range(5000)]
# incrementing rows and cols vectors by bombs points
for r, c in data[1:]:
rows[r] += 1
cols[c] += 1
# summing each item in the cols vector with each item in rows vector
for i in range(len(cols)):
row = []
for item in cols:
item += rows[i]
row.append(item)
array.append(row)
# removing intersections
for point in data[1:]:
array[point[0]][point[1]] -= 1
for item in array:
print(item)