# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134460 | 2019-07-22T17:26:53 Z | Kastanda | Sequence (BOI14_sequence) | C++11 | 276 ms | 1528 KB |
// ItnoE #include<bits/stdc++.h> using namespace std; typedef long long ll; inline ll Solve(vector < int > A, bool w) { int n = (int)A.size(); bool Fail = 1; for (int a : A) if (a) Fail = 0; if (Fail) return (!w); if (n == 1) { ll rs = 0; for (int i = 1; i <= 9; i ++) if (A[0] >> i & 1) { rs = rs * 10 + i; if (A[0] & 1) rs *= 10, A[0] ^= 1; } if (A[0] & 1) rs = 10; return (rs); } ll rs = (ll)1e18; for (int i = 0; i <= 9; i ++) { int d = i; vector < int > B; for (int j = 0; j < n; j ++) { if (!j || !d) B.push_back(0); int b = A[j]; if (b >> d & 1) b ^= (1 << d); B.back() |= b; d ++; if (d == 10) d = 0; } if (A == B) continue; ll rt = Solve(B, w | (i > 0)) * 10 + i; if (!rt && (!w || A[0] & 1)) continue; rs = min(rs, rt); } return (rs); } int main() { int n; scanf("%d", &n); vector < int > A(n); for (int &a : A) scanf("%d", &a), a = 1 << a; return !printf("%lld\n", Solve(A, 0)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 380 KB | Output is correct |
8 | Correct | 3 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 4 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 3 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 4 ms | 256 KB | Output is correct |
12 | Correct | 4 ms | 256 KB | Output is correct |
13 | Correct | 4 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 4 ms | 252 KB | Output is correct |
17 | Correct | 5 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 256 KB | Output is correct |
19 | Correct | 3 ms | 256 KB | Output is correct |
20 | Correct | 4 ms | 256 KB | Output is correct |
21 | Correct | 3 ms | 256 KB | Output is correct |
22 | Correct | 5 ms | 256 KB | Output is correct |
23 | Correct | 5 ms | 392 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 28 ms | 376 KB | Output is correct |
3 | Correct | 28 ms | 376 KB | Output is correct |
4 | Correct | 28 ms | 376 KB | Output is correct |
5 | Correct | 28 ms | 504 KB | Output is correct |
6 | Correct | 14 ms | 444 KB | Output is correct |
7 | Correct | 103 ms | 1060 KB | Output is correct |
8 | Correct | 110 ms | 888 KB | Output is correct |
9 | Correct | 144 ms | 1372 KB | Output is correct |
10 | Correct | 146 ms | 1408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 123 ms | 760 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 148 ms | 1528 KB | Output is correct |
12 | Correct | 234 ms | 1400 KB | Output is correct |
13 | Correct | 2 ms | 252 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 4 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 256 KB | Output is correct |
21 | Correct | 2 ms | 256 KB | Output is correct |
22 | Correct | 3 ms | 256 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 256 KB | Output is correct |
25 | Correct | 5 ms | 256 KB | Output is correct |
26 | Correct | 5 ms | 256 KB | Output is correct |
27 | Correct | 28 ms | 364 KB | Output is correct |
28 | Correct | 28 ms | 376 KB | Output is correct |
29 | Correct | 28 ms | 376 KB | Output is correct |
30 | Correct | 28 ms | 504 KB | Output is correct |
31 | Correct | 13 ms | 376 KB | Output is correct |
32 | Correct | 103 ms | 1144 KB | Output is correct |
33 | Correct | 108 ms | 888 KB | Output is correct |
34 | Correct | 144 ms | 1400 KB | Output is correct |
35 | Correct | 145 ms | 1528 KB | Output is correct |
36 | Correct | 193 ms | 1188 KB | Output is correct |
37 | Correct | 255 ms | 1400 KB | Output is correct |
38 | Correct | 156 ms | 888 KB | Output is correct |
39 | Correct | 276 ms | 1468 KB | Output is correct |
40 | Correct | 263 ms | 1400 KB | Output is correct |