test/cpv/aizu-itp2/itp2_5_c.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/all/ITP2_5_C | ||
| 2 | #include "../../../src/edh/cantor/inv/lib.hpp" | ||
| 3 | #include "../../../src/edh/cantor/seq/lib.hpp" | ||
| 4 | #include "../../../src/edh/cantor/seq2val/lib.hpp" | ||
| 5 | #include "../../../src/edh/cantor/val2seq/lib.hpp" | ||
| 6 | #include "../../../src/io/container/lib.hpp" | ||
| 7 | |||
| 8 | using namespace tifa_libs; | ||
| 9 | 40 | int main() { | |
| 10 |
1/2✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
40 | std::cin.tie(nullptr)->std::ios::sync_with_stdio(false); |
| 11 | u32 n; | ||
| 12 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | std::cin >> n; |
| 13 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | vecu p(n); |
| 14 | 40 | std::cin >> p; | |
| 15 | 40 | auto s = cantor_seq(p); | |
| 16 | 40 | auto fact = gen_fact((u32)s.size(), -1_u64); | |
| 17 | 40 | u64 v = cantor_seq2val(s, fact); | |
| 18 |
3/4✓ Branch 0 taken 36 times.
✓ Branch 1 taken 4 times.
✓ Branch 8 taken 36 times.
✗ Branch 9 not taken.
|
40 | if (v > 1) std::cout << cantor_inv_seq(cantor_val2seq(v - 1, fact)) << '\n'; |
| 19 |
1/2✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
40 | std::cout << p << '\n'; |
| 20 |
3/4✓ Branch 1 taken 35 times.
✓ Branch 2 taken 5 times.
✓ Branch 9 taken 35 times.
✗ Branch 10 not taken.
|
40 | if (v < fact.back() * n) std::cout << cantor_inv_seq(cantor_val2seq(v + 1, fact)) << '\n'; |
| 21 | 40 | return 0; | |
| 22 | 40 | } | |
| 23 |