#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define pb push_back
#define F first
#define S second
#define len(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define file freopen("connect.in", "r", stdin);freopen("connect.out", "w", stdout);
#define kill(x) {cout << x << '\n'; continue;}
//#define int long long
const int maxn = 1e7 + 5, LG = 20, MOD = 1e9+7;// 998244353
const ll inf = 1061109567;
//priority_queue< pii , vector<pii> , greater<pii> pq;
int n;
string a;
bool mark[maxn][10];
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
for(int i = 1; i <= maxn; ++i) {
string s = to_string(i);
for(auto j : s) mark[i][j - '0'] = true;
}
cin >> n;
for(int i = 0; i < n; ++i) {int x; cin >> x; a += ((char) x + '0');}
for(int i = 1; i <= maxn; ++i) {
bool B = 1;
for(int j = 0; j < n; ++j) {
if(!mark[i+j][a[j] - '0']) { B = 0; break; }
}
if(B) {
cout << i << '\n';
break;
}
}
}
// hasan = nigga
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
173 ms |
98512 KB |
Output is correct |
2 |
Correct |
167 ms |
98216 KB |
Output is correct |
3 |
Correct |
185 ms |
98056 KB |
Output is correct |
4 |
Correct |
170 ms |
98132 KB |
Output is correct |
5 |
Correct |
169 ms |
98072 KB |
Output is correct |
6 |
Correct |
166 ms |
98180 KB |
Output is correct |
7 |
Correct |
171 ms |
98220 KB |
Output is correct |
8 |
Correct |
171 ms |
98128 KB |
Output is correct |
9 |
Correct |
184 ms |
98208 KB |
Output is correct |
10 |
Correct |
167 ms |
98132 KB |
Output is correct |
11 |
Correct |
186 ms |
98168 KB |
Output is correct |
12 |
Correct |
168 ms |
98128 KB |
Output is correct |
13 |
Correct |
172 ms |
98264 KB |
Output is correct |
14 |
Correct |
166 ms |
98128 KB |
Output is correct |
15 |
Correct |
173 ms |
98204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
165 ms |
98128 KB |
Output is correct |
2 |
Correct |
165 ms |
98132 KB |
Output is correct |
3 |
Correct |
175 ms |
98252 KB |
Output is correct |
4 |
Correct |
166 ms |
98132 KB |
Output is correct |
5 |
Correct |
167 ms |
98384 KB |
Output is correct |
6 |
Correct |
166 ms |
98224 KB |
Output is correct |
7 |
Correct |
177 ms |
98132 KB |
Output is correct |
8 |
Correct |
169 ms |
98284 KB |
Output is correct |
9 |
Correct |
167 ms |
98188 KB |
Output is correct |
10 |
Correct |
167 ms |
98276 KB |
Output is correct |
11 |
Execution timed out |
1008 ms |
98216 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
168 ms |
98132 KB |
Output is correct |
2 |
Correct |
171 ms |
98288 KB |
Output is correct |
3 |
Correct |
670 ms |
98388 KB |
Output is correct |
4 |
Correct |
174 ms |
98184 KB |
Output is correct |
5 |
Correct |
722 ms |
98312 KB |
Output is correct |
6 |
Correct |
168 ms |
98132 KB |
Output is correct |
7 |
Correct |
322 ms |
98220 KB |
Output is correct |
8 |
Correct |
678 ms |
98384 KB |
Output is correct |
9 |
Correct |
473 ms |
98480 KB |
Output is correct |
10 |
Correct |
573 ms |
98504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
166 ms |
98132 KB |
Output is correct |
2 |
Correct |
166 ms |
98132 KB |
Output is correct |
3 |
Correct |
167 ms |
98388 KB |
Output is correct |
4 |
Correct |
165 ms |
98128 KB |
Output is correct |
5 |
Incorrect |
203 ms |
98384 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |