-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataGeneration.py
31 lines (27 loc) · 975 Bytes
/
DataGeneration.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
import random
# TODO:
# - write cases with changing elements
# - write cases without chanding elements
# with changing elements
MAX = 10**9
Q_N_MAX = 10**5
with open("data/data1.txt", "w") as outFile:
# N, Q = random.randint(1, Q_N_MAX), random.randint(1, Q_N_MAX)
N, Q = Q_N_MAX, Q_N_MAX
outFile.write(f"{N} {Q}\n")
arr = [random.randint(1, MAX) for i in range(N)]
outFile.write(" ".join(list(map(str, arr))) + "\n")
for _ in range(Q):
typeOfQuery = random.randint(1, 2)
if typeOfQuery == 1:
# length = random.randint(1, N)
# l1 = random.randint(1, N - length)
# r1 = l1 + length
# l2 = random.randint(1, N - length)
# r2 = l2 + length
outFile.write(f"{typeOfQuery} {1} {N} {1} {N}\n")
else:
ind = random.randint(1, N)
val = random.randint(1, MAX)
outFile.write(f"{typeOfQuery} {ind} {val}\n")
outFile.close()