GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 24 / 0 / 24
Functions: 100.0% 4 / 0 / 4
Branches: 85.7% 12 / 0 / 14

test/cpv/aizu-grl/grl_5_e.cpp
Line Branch Exec Source
1 // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/all/GRL_5_E
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 82205927 T op(T a, T b) { return T{a.first + b.first, a.second + b.second}; }
13 55715660 void mapping(T& a, F f) { a.first += f * a.second; }
14 24426748 void composition(F& f, F g) { f += g; }
15
16 32 int main() {
17 u32 n, q;
18 32 fin_uint >> n;
19
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 vecii b(n, 0);
20
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 vec<T> a(n);
21 32 tree_t tr_(n);
22
2/2
✓ Branch 0 taken 914848 times.
✓ Branch 1 taken 32 times.
914880 for (u32 u = 0, k; u < n; ++u) {
23 914848 fin_uint >> k;
24
2/2
✓ Branch 2 taken 914816 times.
✓ Branch 3 taken 914848 times.
1829664 for (u32 i = 0, v; i < k; ++i) fin_uint >> v, tr_.add_edge(u, v);
25 }
26 32 hld<tree_t, T, op, F, mapping, composition> tr({0, 0}, 0, tr_);
27
2/2
✓ Branch 5 taken 914848 times.
✓ Branch 6 taken 32 times.
914880 flt_ (u32, i, 0, n) a[tr.info.dfn[i]].first = b[i], a[tr.info.dfn[i]].second = 1;
28 32 tr.build(a);
29 32 fin_uint >> q;
30
2/2
✓ Branch 0 taken 2835045 times.
✓ Branch 1 taken 32 times.
2835077 for (u32 i = 0, opt, u; i < q; ++i) {
31 2835045 fin_uint >> opt >> u;
32
2/2
✓ Branch 0 taken 1316911 times.
✓ Branch 1 taken 1518134 times.
2835045 if (opt == 0) {
33 i64 x;
34 1316911 fin_uint >> x;
35 1316911 tr.chain_update((u32)u, 0, x);
36 1316911 tr.node_update(0, -x);
37 } else {
38 1518134 fout << tr.chain_query((u32)u, 0).first << '\n';
39 }
40 }
41 32 return 0;
42 32 }
43