/
sortable_array.test.cpp
62 lines (56 loc) · 1.13 KB
/
sortable_array.test.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
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
#define PROBLEM "https://judge.yosupo.jp/problem/aplusb"
#include "my_template.hpp"
#include "ds/sortable_array.hpp"
#include "random/base.hpp"
void test() {
int N = RNG(1, 64);
int MAX = RNG(2, 20);
vc<int> A(N);
FOR(i, N) A[i] = RNG(MAX);
Sortable_Array<1000> X(MAX, A);
int Q = 1000;
FOR(Q) {
int t = RNG(0, 5);
if (t == 0) {
vc<int> B = X.get_all();
assert(A == B);
}
if (t == 0) {
int idx = RNG(0, N);
assert(A[idx] == X.get(idx));
}
if (t == 2) {
int idx = RNG(0, N);
int x = RNG(MAX);
A[idx] = x;
X.set(idx, x);
}
if (t == 3) {
int L = RNG(0, N);
int R = RNG(0, N);
if (L > R) swap(L, R);
++R;
X.sort_inc(L, R);
sort(A.begin() + L, A.begin() + R);
}
if (t == 4) {
int L = RNG(0, N);
int R = RNG(0, N);
if (L > R) swap(L, R);
++R;
X.sort_dec(L, R);
sort(A.begin() + L, A.begin() + R);
reverse(A.begin() + L, A.begin() + R);
}
}
}
void solve() {
int a, b;
cin >> a >> b;
cout << a + b << "\n";
}
signed main() {
FOR(100) test();
solve();
return 0;
}