#include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
vector<int> B(K);
for (int &v : B) {
cin >> v;
}
for (int N = 1; N <= 1000; N++) {
bool Good = true;
for (int i = 0; i < K; i++) {
int tmp = N + i;
bool good = false;
while (tmp > 0) {
if (tmp % 10 == B[i]) {
good = true;
}
tmp /= 10;
}
if (!good) {
Good = false;
}
}
if (Good) {
cout << N << "\n";
exit(0);
}
}
for (int x = 1; x <= 1000000; x *= 10) {
for (int y = 1; y <= 10; y++) {
int N = x * y;
bool Good = true;
for (int i = 0; i < K; i++) {
int tmp = N + i;
bool good = false;
while (tmp > 0) {
if (tmp % 10 == B[i]) {
good = true;
}
tmp /= 10;
}
if (!good) {
Good = false;
}
}
if (Good) {
cout << N << "\n";
exit(0);
}
}
}
assert(false);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
4 ms |
276 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
4 ms |
212 KB |
Output is correct |
15 |
Correct |
4 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Runtime error |
4 ms |
468 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
50 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Runtime error |
219 ms |
716 KB |
Execution killed with signal 6 |
6 |
Halted |
0 ms |
0 KB |
- |