This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// In the name of God
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int k;
cin >> k;
vector<int> d(k);
for(int i = 0; i < k; i++) cin >> d[i];
function<bool(int,int)> check = [&](int N, int di) {
while(N) {
if(N % 10 == di) {
return true;
}
N /= 10;
}
return false;
};
for(int i = 0; i <= 1000; i++) {
bool f = true;
for(int j = 0; j < k; j++) {
if(!check(i + j, d[j])) {
f = false;
break;
}
}
if(f) {
cout << i;
exit(0);
}
}
return 0;
}
# | 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... |