test/cpv/library-checker-datastructure/deque_operate_all_composite.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/deque_operate_all_composite | ||
| 2 | #include "../../../src/ds/dq/w/lib.hpp" | ||
| 3 | #include "../../../src/math/ds/mint/ms/lib.hpp" | ||
| 4 | |||
| 5 | using namespace tifa_libs; | ||
| 6 | using mint = mint_ms<998244353>; | ||
| 7 | using T = ptt<mint>; | ||
| 8 | 152536 | T e() { return T{1, 0}; } | |
| 9 | 5363100 | T op(T b, T a) { return T{a.first * b.first, a.first * b.second + a.second}; } | |
| 10 | 16 | int main() { | |
| 11 |
1/2✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
|
16 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 12 | u64 n; | ||
| 13 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
16 | std::cin >> n; |
| 14 | 16 | deque_with_w<T, e, op> deq; | |
| 15 |
2/2✓ Branch 0 taken 5406316 times.
✓ Branch 1 taken 16 times.
|
5406332 | for (u32 i = 0, opt; i < n; ++i) { |
| 16 |
1/2✓ Branch 1 taken 5406316 times.
✗ Branch 2 not taken.
|
5406316 | std::cin >> opt; |
| 17 | 5406316 | mint a, b; | |
| 18 |
2/2✓ Branch 0 taken 1456994 times.
✓ Branch 1 taken 3949322 times.
|
5406316 | if (opt == 0) std::cin >> a >> b, deq.push_front({a, b}); |
| 19 |
2/2✓ Branch 0 taken 1459156 times.
✓ Branch 1 taken 2490166 times.
|
3949322 | else if (opt == 1) std::cin >> a >> b, deq.push_back({a, b}); |
| 20 |
2/2✓ Branch 0 taken 532025 times.
✓ Branch 1 taken 1958141 times.
|
2490166 | else if (opt == 2) deq.pop_front(); |
| 21 |
2/2✓ Branch 0 taken 531116 times.
✓ Branch 1 taken 1427025 times.
|
1958141 | else if (opt == 3) deq.pop_back(); |
| 22 | else { | ||
| 23 | 1427025 | std::cin >> a; | |
| 24 | 1427025 | auto ret = deq.w(); | |
| 25 |
1/2✓ Branch 4 taken 1427025 times.
✗ Branch 5 not taken.
|
1427025 | std::cout << ret.first * a + ret.second << '\n'; |
| 26 | } | ||
| 27 | } | ||
| 28 | 16 | return 0; | |
| 29 | 16 | } | |
| 30 |