Yevhenii Mianovskyi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# generating random points and zeros array
import random
data = [[5000, 500000]]
bombs = 0
while bombs < data[0][1]:
item = [random.randint(0,4999) for i in range(2)]
data.append(item)
bombs += 1
rows = data[0][0]
columns = data[0][0]
array = [[0 for c in range(columns)] for r in range(rows)]
# incrementing rows and cols
for row, col in data[1:]:
array[row] = [i + 1 for i in array[row][:]]
for row_ in array:
row_[col] += 1
# removing intersections
for point in data[1:]:
array[point[0]][point[1]] -= 1