GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 17 / 0 / 17
Functions: 100.0% 1 / 0 / 1
Branches: 60.0% 24 / 0 / 40

test/cpv/library-checker-datastructure/static_range_frequency.hash-chash.hashmap-std_hmap.cpp
Line Branch Exec Source
1 #define AUTO_GENERATED
2 // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/static_range_frequency
3 #include "../../../src/util/alias/others/lib.hpp"
4 //
5
6 using namespace tifa_libs;
7 template <class T>
8 using hashfunc_t = chash<T>;
9 using namespace tifa_libs;
10 template <class K, class V>
11 using hashmap = std::unordered_map<K, V, std::conditional_t<std::is_void_v<hashfunc_t<K>>, std::hash<K>, hashfunc_t<K>>>;
12
13 11 int main() {
14
1/2
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
11 std::cin.tie(nullptr)->std::ios::sync_with_stdio(false);
15 u32 n, q;
16
2/4
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 11 times.
✗ Branch 5 not taken.
11 std::cin >> n >> q;
17
1/2
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
11 vecu a(n);
18
3/4
✓ Branch 4 taken 2906500 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2906500 times.
✓ Branch 9 taken 11 times.
2906511 for (auto& i : a) std::cin >> i;
19 11 hashmap<u32, vecu> hm;
20
4/6
✓ Branch 2 taken 2906500 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2906500 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2906500 times.
✓ Branch 8 taken 11 times.
2906511 flt_ (u32, i, 0, n) hm[a[i]].push_back(i);
21
2/2
✓ Branch 0 taken 4206477 times.
✓ Branch 1 taken 11 times.
4206488 flt_ (u32, i, 1, q + 1, l, r, x) {
22
3/6
✓ Branch 1 taken 4206477 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4206477 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4206477 times.
✗ Branch 8 not taken.
4206477 std::cin >> l >> r >> x;
23
2/2
✓ Branch 0 taken 1083508 times.
✓ Branch 1 taken 3122969 times.
4206477 if (l == r) {
24
1/2
✓ Branch 1 taken 1083508 times.
✗ Branch 2 not taken.
1083508 std::cout << "0\n";
25 1083508 continue;
26 }
27
1/2
✓ Branch 1 taken 3122969 times.
✗ Branch 2 not taken.
3122969 auto CR now = hm[x];
28
2/4
✓ Branch 1 taken 3122969 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3122969 times.
✗ Branch 5 not taken.
3122969 auto it1 = std::ranges::lower_bound(now, l), it2 = std::ranges::upper_bound(now, r - 1);
29
2/4
✓ Branch 2 taken 3122969 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3122969 times.
✗ Branch 6 not taken.
3122969 std::cout << it2 - it1 << '\n';
30 }
31 11 return 0;
32 11 }
33