/// ITNOG
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
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];
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
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;
return 0;
}
// Yesterday is history
// Tomorrow is a mystery
// but today is a gift
// That is why it is called the present
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
224 ms |
100052 KB |
Output is correct |
2 |
Correct |
226 ms |
100544 KB |
Output is correct |
3 |
Correct |
223 ms |
100372 KB |
Output is correct |
4 |
Correct |
221 ms |
100064 KB |
Output is correct |
5 |
Correct |
227 ms |
100088 KB |
Output is correct |
6 |
Correct |
221 ms |
100300 KB |
Output is correct |
7 |
Correct |
224 ms |
100296 KB |
Output is correct |
8 |
Correct |
240 ms |
100176 KB |
Output is correct |
9 |
Correct |
224 ms |
100180 KB |
Output is correct |
10 |
Correct |
246 ms |
100308 KB |
Output is correct |
11 |
Correct |
227 ms |
100456 KB |
Output is correct |
12 |
Correct |
225 ms |
100176 KB |
Output is correct |
13 |
Correct |
229 ms |
100436 KB |
Output is correct |
14 |
Correct |
231 ms |
100204 KB |
Output is correct |
15 |
Correct |
223 ms |
100176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
222 ms |
100176 KB |
Output is correct |
2 |
Correct |
238 ms |
100176 KB |
Output is correct |
3 |
Correct |
226 ms |
100296 KB |
Output is correct |
4 |
Correct |
222 ms |
100180 KB |
Output is correct |
5 |
Correct |
226 ms |
100088 KB |
Output is correct |
6 |
Correct |
231 ms |
100304 KB |
Output is correct |
7 |
Correct |
229 ms |
100176 KB |
Output is correct |
8 |
Correct |
223 ms |
100064 KB |
Output is correct |
9 |
Correct |
241 ms |
100436 KB |
Output is correct |
10 |
Correct |
228 ms |
100180 KB |
Output is correct |
11 |
Execution timed out |
1045 ms |
100176 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
227 ms |
100432 KB |
Output is correct |
2 |
Correct |
969 ms |
100352 KB |
Output is correct |
3 |
Execution timed out |
1036 ms |
100124 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
225 ms |
100300 KB |
Output is correct |
2 |
Correct |
223 ms |
100100 KB |
Output is correct |
3 |
Correct |
221 ms |
100184 KB |
Output is correct |
4 |
Correct |
223 ms |
100084 KB |
Output is correct |
5 |
Execution timed out |
1063 ms |
100356 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |