test/cpv/library-checker-datastructure/associative_array.rbtree.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/associative_array | ||
| 2 | #include "../../../src/ds/bst/rbt/lib.hpp" | ||
| 3 | |||
| 4 | using namespace tifa_libs; | ||
| 5 | 20 | int main() { | |
| 6 |
1/2✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
|
20 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 7 | u64 q; | ||
| 8 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | std::cin >> q; |
| 9 | 20 | rbtree<pttuu> tr; | |
| 10 |
2/2✓ Branch 0 taken 15673163 times.
✓ Branch 1 taken 20 times.
|
15673183 | for (u64 i = 0, op, k, v; i < q; ++i) { |
| 11 |
2/4✓ Branch 1 taken 15673163 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15673163 times.
✗ Branch 5 not taken.
|
15673163 | std::cin >> op >> k; |
| 12 | 15673163 | auto it = tr.lower_bound({k, 0}); | |
| 13 |
2/2✓ Branch 0 taken 7647884 times.
✓ Branch 1 taken 8025279 times.
|
15673163 | if (op) { |
| 14 |
6/8✓ Branch 0 taken 4747665 times.
✓ Branch 1 taken 2900219 times.
✓ Branch 2 taken 1764454 times.
✓ Branch 3 taken 2983211 times.
✓ Branch 5 taken 7647884 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 7647884 times.
✗ Branch 9 not taken.
|
7647884 | std::cout << (it && it->data.first == k ? it->data.second : 0) << '\n'; |
| 15 | } else { | ||
| 16 |
1/2✓ Branch 1 taken 8025279 times.
✗ Branch 2 not taken.
|
8025279 | std::cin >> v; |
| 17 |
4/4✓ Branch 0 taken 5325248 times.
✓ Branch 1 taken 2700031 times.
✓ Branch 2 taken 2151443 times.
✓ Branch 3 taken 3173805 times.
|
8025279 | if (it && it->data.first == k) it->data.second = v; |
| 18 | 5873836 | else tr.insert({k, v}); | |
| 19 | } | ||
| 20 | } | ||
| 21 | 20 | return 0; | |
| 22 | 20 | } | |
| 23 |