# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103505 | wilwxk | Sequence (BOI14_sequence) | C++11 | 3 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5;
int v[MAXN];
int n;
bool procura(int val, int k) {
if(val==k) return 1;
while(val>=10) {
if(val%10==k||val/10==k) return 1;
val/=10;
}
if(val%10==k||val/10==k) return 1;
return 0;
}
bool testa(int k) {
for(int i=1; i<=n; i++) {
int cur=k+i-1;
//printf("testando %d > %d %d > %d\n", k, cur, v[i], procura(cur, v[i]));
if(!procura(cur, v[i])) return 0;
}
return 1;
}
int main() {
scanf("%d", &n);
for(int i=1; i<=n; i++) scanf("%d", &v[i]);
for(int i=0; i<=5000; i++) {
if(testa(i)) {
printf("%d\n", i);
return 0;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |