test/cpv/library-checker-datastructure/point_add_rectangle_sum.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/point_add_rectangle_sum | ||
| 2 | #include "../../../src/ds/kdtree/lib.hpp" | ||
| 3 | |||
| 4 | using namespace tifa_libs; | ||
| 5 | 361613673 | i64 op(i64 x, i64 y) { return x + y; } | |
| 6 | |||
| 7 | 18 | int main() { | |
| 8 |
1/2✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 9 | u32 n, q; | ||
| 10 |
2/4✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
|
18 | std::cin >> n >> q; |
| 11 | 18 | kdtree<i64, op> kdt(3000); | |
| 12 | using point_t = decltype(kdt)::point; | ||
| 13 | point_t p1, p2; | ||
| 14 | i64 w; | ||
| 15 |
2/2✓ Branch 0 taken 973653 times.
✓ Branch 1 taken 18 times.
|
973671 | flt_ (u32, i, 0, n) { |
| 16 |
3/6✓ Branch 2 taken 973653 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 973653 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 973653 times.
✗ Branch 10 not taken.
|
973653 | std::cin >> p1[0] >> p1[1] >> w; |
| 17 | 973653 | kdt.insert(p1, w); | |
| 18 | } | ||
| 19 |
2/2✓ Branch 0 taken 991808 times.
✓ Branch 1 taken 18 times.
|
991826 | flt_ (u32, i, 0, q, opt) { |
| 20 |
3/6✓ Branch 1 taken 991808 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 991808 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 991808 times.
✗ Branch 10 not taken.
|
991808 | std::cin >> opt >> p1[0] >> p1[1]; |
| 21 |
2/2✓ Branch 0 taken 429611 times.
✓ Branch 1 taken 562197 times.
|
991808 | if (!opt) { |
| 22 |
1/2✓ Branch 1 taken 429611 times.
✗ Branch 2 not taken.
|
429611 | std::cin >> w; |
| 23 | 429611 | kdt.insert(p1, w); | |
| 24 | } else { | ||
| 25 |
2/4✓ Branch 2 taken 562197 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 562197 times.
✗ Branch 7 not taken.
|
562197 | std::cin >> p2[0] >> p2[1]; |
| 26 | 562197 | --p2[0], --p2[1]; | |
| 27 |
2/4✓ Branch 2 taken 562197 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 562197 times.
✗ Branch 6 not taken.
|
562197 | std::cout << kdt.query(p1, p2) << '\n'; |
| 28 | } | ||
| 29 | } | ||
| 30 | 18 | return 0; | |
| 31 | 18 | } | |
| 32 |