# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38526 | bakurits | Sequence (BOI14_sequence) | C++14 | 1000 ms | 41468 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 <iostream>
#include <stdio.h>
const int N = 1e5 + 10;
const int BIG_N = 1e7;
using namespace std;
int n;
int a[N], mask[BIG_N];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
for (int i = 1; i < BIG_N; i++) {
int x = i;
while (x > 0) {
mask[i] |= (1 << (x %10));
x /= 10;
}
}
for (int i = 1; i < BIG_N; i++) {
bool flag = true;
for (int j = 0; j < n; j++) {
if (!(mask[i + j] & (1 << a[j]))) {
flag = false;
break;
}
}
if (flag) {
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... |