# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
544506 | 2022-04-02T07:03:13 Z | model_code | Broken Device 2 (JOI22_device2) | C++17 | 102 ms | 2884 KB |
#include <utility> #include <vector> #include "Anna.h" namespace { long long int dp[200]; }; int Declare(void) { dp[1] = 1; dp[2] = 1; dp[3] = 2; for (int i = 4; i <= 140; i++) { dp[i] = dp[i - 2] + dp[i - 3] + 1; } return 140; } std::pair<std::vector<int>, std::vector<int> > Anna(long long int A) { std::vector<int> s, t; A--; long long int parity = A % 2; A /= 2; A++; long long int sum = 0; int len = 0; while (sum < A) { sum += dp[++len]; } long long int k = A - (sum - dp[len]); std::vector<int> arr; int index = len; while (true) { // A-th in lex order if (k == 1) { break; } else if (k <= dp[index - 2] + 1) { arr.push_back(2); k -= 1; index -= 2; } else { arr.push_back(3); k -= (dp[index - 2] + 1); index -= 3; } } // std::vector<int> arr; // for (int i = 0; i < 60; i++) { // if ((A >> i) & 1LL) { // arr.push_back(3); // } else { // arr.push_back(2); // } // } int b = 1; s.push_back(b); for (int i = 0; i < arr.size(); i++) { if (arr[i] == 3) b ^= 1; for (int j = 0; j < arr[i]; j++) { s.push_back(b); } } int sz = s.size(); while (sz < len) { b ^= 1; s.push_back(b); sz++; } for (int i = 0; i < s.size(); i++) { t.push_back(1 - i % 2); } if (parity) { for (int i = 0; i < s.size(); i++) { s[i] ^= 1; t[i] ^= 1; } } return std::make_pair(s, t); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 508 KB | Output is correct |
2 | Correct | 17 ms | 800 KB | Output is correct |
3 | Correct | 21 ms | 1020 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 508 KB | Output is correct |
2 | Correct | 17 ms | 800 KB | Output is correct |
3 | Correct | 21 ms | 1020 KB | Output is correct |
4 | Correct | 34 ms | 1308 KB | Output is correct |
5 | Correct | 30 ms | 1304 KB | Output is correct |
6 | Correct | 31 ms | 1236 KB | Output is correct |
7 | Correct | 32 ms | 1292 KB | Output is correct |
8 | Correct | 33 ms | 1244 KB | Output is correct |
9 | Correct | 40 ms | 1352 KB | Output is correct |
10 | Correct | 41 ms | 1396 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 508 KB | Output is correct |
2 | Correct | 17 ms | 800 KB | Output is correct |
3 | Correct | 21 ms | 1020 KB | Output is correct |
4 | Correct | 34 ms | 1308 KB | Output is correct |
5 | Correct | 30 ms | 1304 KB | Output is correct |
6 | Correct | 31 ms | 1236 KB | Output is correct |
7 | Correct | 32 ms | 1292 KB | Output is correct |
8 | Correct | 33 ms | 1244 KB | Output is correct |
9 | Correct | 40 ms | 1352 KB | Output is correct |
10 | Correct | 41 ms | 1396 KB | Output is correct |
11 | Correct | 34 ms | 1272 KB | Output is correct |
12 | Correct | 36 ms | 1440 KB | Output is correct |
13 | Correct | 39 ms | 1200 KB | Output is correct |
14 | Correct | 38 ms | 1444 KB | Output is correct |
15 | Correct | 38 ms | 1444 KB | Output is correct |
16 | Correct | 42 ms | 1360 KB | Output is correct |
17 | Correct | 33 ms | 1316 KB | Output is correct |
18 | Correct | 33 ms | 1116 KB | Output is correct |
19 | Correct | 35 ms | 1184 KB | Output is correct |
20 | Correct | 36 ms | 1268 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 508 KB | Output is correct |
2 | Correct | 17 ms | 800 KB | Output is correct |
3 | Correct | 21 ms | 1020 KB | Output is correct |
4 | Correct | 34 ms | 1308 KB | Output is correct |
5 | Correct | 30 ms | 1304 KB | Output is correct |
6 | Correct | 31 ms | 1236 KB | Output is correct |
7 | Correct | 32 ms | 1292 KB | Output is correct |
8 | Correct | 33 ms | 1244 KB | Output is correct |
9 | Correct | 40 ms | 1352 KB | Output is correct |
10 | Correct | 41 ms | 1396 KB | Output is correct |
11 | Correct | 34 ms | 1272 KB | Output is correct |
12 | Correct | 36 ms | 1440 KB | Output is correct |
13 | Correct | 39 ms | 1200 KB | Output is correct |
14 | Correct | 38 ms | 1444 KB | Output is correct |
15 | Correct | 38 ms | 1444 KB | Output is correct |
16 | Correct | 42 ms | 1360 KB | Output is correct |
17 | Correct | 33 ms | 1316 KB | Output is correct |
18 | Correct | 33 ms | 1116 KB | Output is correct |
19 | Correct | 35 ms | 1184 KB | Output is correct |
20 | Correct | 36 ms | 1268 KB | Output is correct |
21 | Correct | 41 ms | 1356 KB | Output is correct |
22 | Correct | 48 ms | 1500 KB | Output is correct |
23 | Correct | 42 ms | 1384 KB | Output is correct |
24 | Correct | 44 ms | 1372 KB | Output is correct |
25 | Correct | 38 ms | 1420 KB | Output is correct |
26 | Correct | 44 ms | 1484 KB | Output is correct |
27 | Correct | 45 ms | 1520 KB | Output is correct |
28 | Correct | 38 ms | 1292 KB | Output is correct |
29 | Correct | 39 ms | 1312 KB | Output is correct |
30 | Correct | 37 ms | 1412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 508 KB | Output is correct |
2 | Correct | 17 ms | 800 KB | Output is correct |
3 | Correct | 21 ms | 1020 KB | Output is correct |
4 | Correct | 34 ms | 1308 KB | Output is correct |
5 | Correct | 30 ms | 1304 KB | Output is correct |
6 | Correct | 31 ms | 1236 KB | Output is correct |
7 | Correct | 32 ms | 1292 KB | Output is correct |
8 | Correct | 33 ms | 1244 KB | Output is correct |
9 | Correct | 40 ms | 1352 KB | Output is correct |
10 | Correct | 41 ms | 1396 KB | Output is correct |
11 | Correct | 34 ms | 1272 KB | Output is correct |
12 | Correct | 36 ms | 1440 KB | Output is correct |
13 | Correct | 39 ms | 1200 KB | Output is correct |
14 | Correct | 38 ms | 1444 KB | Output is correct |
15 | Correct | 38 ms | 1444 KB | Output is correct |
16 | Correct | 42 ms | 1360 KB | Output is correct |
17 | Correct | 33 ms | 1316 KB | Output is correct |
18 | Correct | 33 ms | 1116 KB | Output is correct |
19 | Correct | 35 ms | 1184 KB | Output is correct |
20 | Correct | 36 ms | 1268 KB | Output is correct |
21 | Correct | 41 ms | 1356 KB | Output is correct |
22 | Correct | 48 ms | 1500 KB | Output is correct |
23 | Correct | 42 ms | 1384 KB | Output is correct |
24 | Correct | 44 ms | 1372 KB | Output is correct |
25 | Correct | 38 ms | 1420 KB | Output is correct |
26 | Correct | 44 ms | 1484 KB | Output is correct |
27 | Correct | 45 ms | 1520 KB | Output is correct |
28 | Correct | 38 ms | 1292 KB | Output is correct |
29 | Correct | 39 ms | 1312 KB | Output is correct |
30 | Correct | 37 ms | 1412 KB | Output is correct |
31 | Correct | 50 ms | 1864 KB | Output is correct |
32 | Correct | 48 ms | 1856 KB | Output is correct |
33 | Correct | 58 ms | 1768 KB | Output is correct |
34 | Correct | 54 ms | 1804 KB | Output is correct |
35 | Correct | 49 ms | 1856 KB | Output is correct |
36 | Correct | 48 ms | 2000 KB | Output is correct |
37 | Correct | 57 ms | 1872 KB | Output is correct |
38 | Correct | 53 ms | 1784 KB | Output is correct |
39 | Correct | 55 ms | 1844 KB | Output is correct |
40 | Correct | 56 ms | 1728 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 88 ms | 2724 KB | Output is correct |
2 | Correct | 92 ms | 2776 KB | Output is correct |
3 | Correct | 94 ms | 2640 KB | Output is correct |
4 | Correct | 88 ms | 2796 KB | Output is correct |
5 | Correct | 91 ms | 2636 KB | Output is correct |
6 | Correct | 84 ms | 2728 KB | Output is correct |
7 | Correct | 89 ms | 2800 KB | Output is correct |
8 | Correct | 100 ms | 2684 KB | Output is correct |
9 | Correct | 96 ms | 2776 KB | Output is correct |
10 | Correct | 98 ms | 2704 KB | Output is correct |
11 | Correct | 100 ms | 2804 KB | Output is correct |
12 | Correct | 84 ms | 2628 KB | Output is correct |
13 | Correct | 102 ms | 2820 KB | Output is correct |
14 | Correct | 77 ms | 2884 KB | Output is correct |
15 | Correct | 69 ms | 2652 KB | Output is correct |
16 | Correct | 74 ms | 2676 KB | Output is correct |
17 | Correct | 72 ms | 2552 KB | Output is correct |
18 | Correct | 81 ms | 2632 KB | Output is correct |
19 | Correct | 87 ms | 2696 KB | Output is correct |
20 | Correct | 82 ms | 2656 KB | Output is correct |