-
-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathrandom.cpp
33 lines (29 loc) · 831 Bytes
/
random.cpp
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
#include "random.h"
#include <iostream>
using namespace std;
int main(int, char* argv[]) {
long long seed = atoll(argv[1]);
auto gen = Random(seed);
int n = gen.uniform(1, 500'000);
int q = gen.uniform(1, 500'000);
printf("%d %d\n", n, q);
for (int i = 0; i < n; i++) {
printf("%d", gen.uniform(0, 1'000'000'000));
if (i != n - 1) printf(" ");
}
printf("\n");
for (int i = 0; i < q; i++) {
int t = gen.uniform(0, 1);
printf("%d ", t);
if (t == 0) {
int p = gen.uniform(0, n - 1);
int x = gen.uniform(0, 1'000'000'000);
printf("%d %d\n", p, x);
} else {
auto p = gen.uniform_pair(0, n - 1);
p.second++;
printf("%d %d\n", p.first, p.second);
}
}
return 0;
}