GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 95.7% 22 / 0 / 23
Functions: 75.0% 3 / 0 / 4
Branches: 85.7% 12 / 0 / 14

test/cpv/aizu-grl/grl_5_d.cpp
Line Branch Exec Source
1 // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/all/GRL_5_D
2 #include "../../../src/graph/ds/alist/lib.hpp"
3 #include "../../../src/io/fastin/lib.hpp"
4 #include "../../../src/io/fastout/lib.hpp"
5 #include "../../../src/tree/hld/lib.hpp"
6
7 using namespace tifa_libs;
8 using T = std::pair<i64, i32>;
9 using F = i64;
10 using tree_t = tree<alist<>>;
11
12 34193485 T op(T a, T b) { return T{a.first + b.first, a.second + b.second}; }
13 1217628 void mapping(T& a, F f) { a.first += f; }
14 void composition(F& f, F g) { f += g; }
15
16 36 int main() {
17 u32 n, q;
18 36 fin_uint >> n;
19
1/2
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
36 vecii b(n, 0);
20
1/2
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
36 vec<T> a(n);
21 36 tree_t tr_(n);
22
2/2
✓ Branch 0 taken 914967 times.
✓ Branch 1 taken 36 times.
915003 for (u32 u = 0, k; u < n; ++u) {
23 914967 fin_uint >> k;
24
2/2
✓ Branch 2 taken 914931 times.
✓ Branch 3 taken 914967 times.
1829898 for (u32 i = 0, v; i < k; ++i) fin_uint >> v, tr_.add_edge(u, v);
25 }
26 36 hld<tree_t, T, op, F, mapping, composition> tr({0, 0}, 0, tr_);
27
2/2
✓ Branch 5 taken 914967 times.
✓ Branch 6 taken 36 times.
915003 flt_ (u32, i, 0, n) a[tr.info.dfn[i]].first = b[i], a[tr.info.dfn[i]].second = 1;
28 36 tr.build(a);
29 36 fin_uint >> q;
30
2/2
✓ Branch 0 taken 2636089 times.
✓ Branch 1 taken 36 times.
2636125 for (u32 i = 0, opt, u; i < q; ++i) {
31 2636089 fin_uint >> opt >> u;
32
2/2
✓ Branch 0 taken 1217628 times.
✓ Branch 1 taken 1418461 times.
2636089 if (opt == 0) {
33 i64 x;
34 1217628 fin_uint >> x;
35 1217628 tr.node_update((u32)u, x);
36 } else {
37 1418461 fout << tr.chain_query((u32)u, 0).first << '\n';
38 }
39 }
40 36 return 0;
41 36 }
42