test/cpv/library-checker-datastructure/ordered_set.fhq_treap.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/ordered_set | ||
| 2 | #include "../../../src/ds/bst/fhq/lib.hpp" | ||
| 3 | #include "../../../src/io/fastin/lib.hpp" | ||
| 4 | #include "../../../src/io/fastout/lib.hpp" | ||
| 5 | |||
| 6 | using namespace tifa_libs; | ||
| 7 | 37 | int main() { | |
| 8 | u32 n, q; | ||
| 9 | 37 | fin_uint >> n >> q; | |
| 10 |
1/2✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
|
37 | fhq_treap<u32> treap; |
| 11 |
2/2✓ Branch 0 taken 8006030 times.
✓ Branch 1 taken 37 times.
|
8006067 | flt_ (u32, i, 0, n, x) { |
| 12 | 8006030 | fin_uint >> x; | |
| 13 | 8006030 | treap.insert(x); | |
| 14 | } | ||
| 15 |
2/2✓ Branch 0 taken 17500021 times.
✓ Branch 1 taken 37 times.
|
17500058 | flt_ (u32, i, 0, q, t, x) { |
| 16 | 17500021 | fin_uint >> t >> x; | |
| 17 | 17500021 | auto it = treap.find(x); | |
| 18 |
6/7✓ Branch 0 taken 2982589 times.
✓ Branch 1 taken 2587862 times.
✓ Branch 2 taken 2981723 times.
✓ Branch 3 taken 2982072 times.
✓ Branch 4 taken 2982960 times.
✓ Branch 5 taken 2982815 times.
✗ Branch 6 not taken.
|
17500021 | switch (t) { |
| 19 | 2982589 | case 0: | |
| 20 |
2/2✓ Branch 2 taken 832084 times.
✓ Branch 3 taken 2150505 times.
|
2982589 | if (it == end(treap.data)) treap.insert(x); |
| 21 | 2982589 | break; | |
| 22 | 2587862 | case 1: | |
| 23 |
2/2✓ Branch 2 taken 737304 times.
✓ Branch 3 taken 1850558 times.
|
2587862 | if (it != end(treap.data)) treap.erase(x); |
| 24 | 2587862 | break; | |
| 25 | 2981723 | case 2: | |
| 26 |
2/2✓ Branch 2 taken 154578 times.
✓ Branch 3 taken 2827145 times.
|
2981723 | if (auto _ = treap.kth(x); !_) fout << "-1\n"; |
| 27 |
1/2✓ Branch 1 taken 2827145 times.
✗ Branch 2 not taken.
|
2827145 | else fout << _.value() << '\n'; |
| 28 | 2981723 | break; | |
| 29 | 2982072 | case 3: | |
| 30 | 2982072 | fout << treap.rank(x) - (it == end(treap.data)) << '\n'; | |
| 31 | 2982072 | break; | |
| 32 | 2982960 | case 4: | |
| 33 |
2/2✓ Branch 2 taken 857119 times.
✓ Branch 3 taken 2125841 times.
|
2982960 | if (it != end(treap.data)) fout << it->val << '\n'; |
| 34 |
2/2✓ Branch 2 taken 432259 times.
✓ Branch 3 taken 1693582 times.
|
2125841 | else if (auto _ = treap.prev(x); !_) fout << "-1\n"; |
| 35 |
1/2✓ Branch 1 taken 1693582 times.
✗ Branch 2 not taken.
|
1693582 | else fout << _.value() << '\n'; |
| 36 | 2982960 | break; | |
| 37 | 2982815 | case 5: | |
| 38 |
2/2✓ Branch 2 taken 862368 times.
✓ Branch 3 taken 2120447 times.
|
2982815 | if (it != end(treap.data)) fout << it->val << '\n'; |
| 39 |
2/2✓ Branch 2 taken 498234 times.
✓ Branch 3 taken 1622213 times.
|
2120447 | else if (auto _ = treap.next(x); !_) fout << "-1\n"; |
| 40 |
1/2✓ Branch 1 taken 1622213 times.
✗ Branch 2 not taken.
|
1622213 | else fout << _.value() << '\n'; |
| 41 | 2982815 | break; | |
| 42 | } | ||
| 43 | } | ||
| 44 | 37 | return 0; | |
| 45 | 37 | } | |
| 46 |