///ITNOG
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
constexpr int MOD = 1e9 + 7, N = 1e7 + 8, M = 1e6, SQ = 600, INF = 1e9 + 8, LGN = 22, mod = 998244353, P = 131113;
bitset <10> mark[N];
short int a[N];
int n;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for(int i = 1; i < N; ++ i){
mark[i][i%10] = true;
mark[i] |= mark[i/10];
}
cin >> n;
for (int i = 0; i < N; ++ i){
cin >> a[i];
}
for (int i = 1; i < N; ++ i){
bool ok = true;
for (int j = 0; j < n; ++ j){
if (!mark[i+j][a[j]]){
ok = false;
break;
}
}
if (ok){
cout << i;
return 0;
}
}
cout << -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
78708 KB |
Output is correct |
2 |
Correct |
95 ms |
78672 KB |
Output is correct |
3 |
Correct |
96 ms |
78712 KB |
Output is correct |
4 |
Correct |
95 ms |
78676 KB |
Output is correct |
5 |
Correct |
96 ms |
78712 KB |
Output is correct |
6 |
Correct |
96 ms |
78676 KB |
Output is correct |
7 |
Correct |
99 ms |
78712 KB |
Output is correct |
8 |
Correct |
101 ms |
78672 KB |
Output is correct |
9 |
Correct |
96 ms |
78712 KB |
Output is correct |
10 |
Correct |
97 ms |
78708 KB |
Output is correct |
11 |
Correct |
98 ms |
78672 KB |
Output is correct |
12 |
Correct |
97 ms |
78580 KB |
Output is correct |
13 |
Correct |
98 ms |
78956 KB |
Output is correct |
14 |
Correct |
96 ms |
78476 KB |
Output is correct |
15 |
Correct |
96 ms |
78804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
78716 KB |
Output is correct |
2 |
Correct |
97 ms |
78672 KB |
Output is correct |
3 |
Correct |
96 ms |
78684 KB |
Output is correct |
4 |
Correct |
96 ms |
78960 KB |
Output is correct |
5 |
Correct |
103 ms |
78708 KB |
Output is correct |
6 |
Correct |
97 ms |
78596 KB |
Output is correct |
7 |
Correct |
101 ms |
78888 KB |
Output is correct |
8 |
Correct |
98 ms |
78716 KB |
Output is correct |
9 |
Correct |
96 ms |
78712 KB |
Output is correct |
10 |
Correct |
96 ms |
78672 KB |
Output is correct |
11 |
Incorrect |
577 ms |
78708 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
78672 KB |
Output is correct |
2 |
Correct |
100 ms |
78736 KB |
Output is correct |
3 |
Correct |
338 ms |
78672 KB |
Output is correct |
4 |
Correct |
100 ms |
78672 KB |
Output is correct |
5 |
Correct |
363 ms |
78736 KB |
Output is correct |
6 |
Correct |
98 ms |
78884 KB |
Output is correct |
7 |
Correct |
181 ms |
78672 KB |
Output is correct |
8 |
Correct |
340 ms |
78932 KB |
Output is correct |
9 |
Correct |
251 ms |
80948 KB |
Output is correct |
10 |
Correct |
293 ms |
80944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
78700 KB |
Output is correct |
2 |
Correct |
96 ms |
78672 KB |
Output is correct |
3 |
Correct |
98 ms |
78672 KB |
Output is correct |
4 |
Correct |
96 ms |
78672 KB |
Output is correct |
5 |
Incorrect |
134 ms |
78796 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |