#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, a[N];
bool mark[N][11];
int main() {
ios:: sync_with_stdio(0), cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int w = 1; w <= 200000; w++) {
string s = to_string(w);
for (auto e : s)
mark[w][e - '0'] = true;
}
for (int w = 1; w <= 200000; w++) {
int cnt = w;
bool flag = true;
for (int i = 0; i < n; i++) {
if (i) cnt++;
if (!mark[cnt][a[i]]) {
flag = false;
break;
}
}
if (flag) {
cout << w << '\n';
return 0;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2652 KB |
Output is correct |
2 |
Correct |
5 ms |
2648 KB |
Output is correct |
3 |
Correct |
4 ms |
2652 KB |
Output is correct |
4 |
Correct |
4 ms |
2652 KB |
Output is correct |
5 |
Correct |
4 ms |
2700 KB |
Output is correct |
6 |
Correct |
4 ms |
2652 KB |
Output is correct |
7 |
Correct |
3 ms |
2648 KB |
Output is correct |
8 |
Correct |
4 ms |
2652 KB |
Output is correct |
9 |
Correct |
5 ms |
2696 KB |
Output is correct |
10 |
Correct |
4 ms |
2652 KB |
Output is correct |
11 |
Correct |
3 ms |
2652 KB |
Output is correct |
12 |
Correct |
3 ms |
2652 KB |
Output is correct |
13 |
Correct |
6 ms |
2652 KB |
Output is correct |
14 |
Correct |
4 ms |
2652 KB |
Output is correct |
15 |
Correct |
4 ms |
2696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2648 KB |
Output is correct |
2 |
Correct |
4 ms |
2652 KB |
Output is correct |
3 |
Correct |
3 ms |
2652 KB |
Output is correct |
4 |
Correct |
3 ms |
2516 KB |
Output is correct |
5 |
Correct |
4 ms |
2652 KB |
Output is correct |
6 |
Correct |
3 ms |
2652 KB |
Output is correct |
7 |
Correct |
3 ms |
2652 KB |
Output is correct |
8 |
Correct |
4 ms |
2516 KB |
Output is correct |
9 |
Correct |
4 ms |
2652 KB |
Output is correct |
10 |
Correct |
4 ms |
2648 KB |
Output is correct |
11 |
Incorrect |
11 ms |
2648 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2652 KB |
Output is correct |
2 |
Correct |
10 ms |
2652 KB |
Output is correct |
3 |
Incorrect |
109 ms |
2652 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2512 KB |
Output is correct |
2 |
Correct |
3 ms |
2636 KB |
Output is correct |
3 |
Correct |
4 ms |
2652 KB |
Output is correct |
4 |
Correct |
5 ms |
2652 KB |
Output is correct |
5 |
Incorrect |
6 ms |
2652 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |