/// 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;
bool mark[N][10];
int n, a[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
for (int i = 0; i < N; ++ i){
string s = to_string(i);
for (char ch : s){
mark[i][ch-'0'] = true;
}
}
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;
}
}
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 |
Correct |
226 ms |
100300 KB |
Output is correct |
2 |
Correct |
234 ms |
100208 KB |
Output is correct |
3 |
Correct |
228 ms |
100296 KB |
Output is correct |
4 |
Correct |
231 ms |
100060 KB |
Output is correct |
5 |
Correct |
226 ms |
100052 KB |
Output is correct |
6 |
Correct |
221 ms |
100124 KB |
Output is correct |
7 |
Correct |
263 ms |
100524 KB |
Output is correct |
8 |
Correct |
227 ms |
100308 KB |
Output is correct |
9 |
Correct |
243 ms |
100208 KB |
Output is correct |
10 |
Correct |
222 ms |
100132 KB |
Output is correct |
11 |
Correct |
226 ms |
100176 KB |
Output is correct |
12 |
Correct |
231 ms |
100300 KB |
Output is correct |
13 |
Correct |
222 ms |
100124 KB |
Output is correct |
14 |
Correct |
225 ms |
100304 KB |
Output is correct |
15 |
Correct |
225 ms |
100304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
100176 KB |
Output is correct |
2 |
Correct |
240 ms |
100304 KB |
Output is correct |
3 |
Correct |
225 ms |
100072 KB |
Output is correct |
4 |
Correct |
223 ms |
100176 KB |
Output is correct |
5 |
Correct |
238 ms |
100696 KB |
Output is correct |
6 |
Correct |
228 ms |
100172 KB |
Output is correct |
7 |
Correct |
228 ms |
100076 KB |
Output is correct |
8 |
Correct |
221 ms |
100176 KB |
Output is correct |
9 |
Correct |
238 ms |
100176 KB |
Output is correct |
10 |
Correct |
228 ms |
100432 KB |
Output is correct |
11 |
Execution timed out |
1069 ms |
100044 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
100176 KB |
Output is correct |
2 |
Correct |
973 ms |
100348 KB |
Output is correct |
3 |
Execution timed out |
1029 ms |
100184 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
226 ms |
100200 KB |
Output is correct |
2 |
Correct |
223 ms |
100308 KB |
Output is correct |
3 |
Correct |
224 ms |
100180 KB |
Output is correct |
4 |
Correct |
223 ms |
100300 KB |
Output is correct |
5 |
Execution timed out |
1026 ms |
100436 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |