///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] - '0']){
ok = false;
break;
}
}
if (ok){
cout << i;
return 0;
}
}
cout << -1;
}
// Yesterday is history
// Tomorrow is a mystery
// but today is a gift
// That is why it is called the present
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
78680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
119 ms |
78480 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
78712 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
120 ms |
78672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |