# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41353 | 2018-02-16T18:47:54 Z | gabrielsimoes | Sequence (BOI14_sequence) | C++14 | 321 ms | 15480 KB |
#include <bits/stdc++.h> using namespace std; bool test(int a, int b) { while (a > 0) { if (b == (a % 10)) return true; else a /= 10; } return false; } int n; vector<int> v; int main() { scanf("%d", &n); for (int i = 0, a; i < n; i++) { scanf("%d", &a); v.push_back(a); } if (n <= 10000) { for (int ans = 1; ans <= 10000; ans++) { bool ok = true; for (int i = 0; i < n; i++) { if (!test(ans + i, v[i])) ok = false; } if (ok) { printf("%d\n", ans); return 0; } } } else { int x = v[0]; int start = -1; for (int i = 1; i < 10000000; i++) { if (test(i, x)) { if (start == -1) start = i; if (i - start + 1 >= n) printf("%d\n", i); } else { start = -1; } } // if (x > 0 && x < 9) { // printf("%d", x); // int cur = 1; // while (n >= cur + 1) { // printf("0"); // cur *= 10; // } // printf("\n"); // } // if (x == 9) { // printf("9\n"); // } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 4 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 2 ms | 424 KB | Output is correct |
5 | Correct | 1 ms | 496 KB | Output is correct |
6 | Correct | 1 ms | 532 KB | Output is correct |
7 | Correct | 2 ms | 556 KB | Output is correct |
8 | Correct | 8 ms | 556 KB | Output is correct |
9 | Correct | 1 ms | 556 KB | Output is correct |
10 | Correct | 3 ms | 556 KB | Output is correct |
11 | Correct | 2 ms | 556 KB | Output is correct |
12 | Correct | 1 ms | 556 KB | Output is correct |
13 | Correct | 2 ms | 556 KB | Output is correct |
14 | Correct | 13 ms | 556 KB | Output is correct |
15 | Correct | 12 ms | 556 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 556 KB | Output is correct |
2 | Correct | 4 ms | 576 KB | Output is correct |
3 | Correct | 1 ms | 576 KB | Output is correct |
4 | Correct | 2 ms | 576 KB | Output is correct |
5 | Correct | 1 ms | 576 KB | Output is correct |
6 | Correct | 1 ms | 576 KB | Output is correct |
7 | Correct | 67 ms | 576 KB | Output is correct |
8 | Correct | 2 ms | 576 KB | Output is correct |
9 | Correct | 12 ms | 576 KB | Output is correct |
10 | Correct | 1 ms | 576 KB | Output is correct |
11 | Incorrect | 109 ms | 576 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 576 KB | Output is correct |
2 | Incorrect | 321 ms | 15480 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 15480 KB | Output is correct |
2 | Correct | 4 ms | 15480 KB | Output is correct |
3 | Correct | 2 ms | 15480 KB | Output is correct |
4 | Correct | 2 ms | 15480 KB | Output is correct |
5 | Incorrect | 300 ms | 15480 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |