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>
using namespace std;
const int MAX = 1069;
int n;
int ar[MAX];
inline bool yes(int num)
{
for (int i = 0; i < n; ++i)
{
bool ok = false;
int tmp = num + i;
while (tmp)
{
if (tmp % 10 == ar[i]) { ok = true; break; }
tmp /= 10;
}
if (!ok)
return false;
}
return true;
}
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; ++i)
cin >> ar[i];
for (int i = 1;; ++i)
{
if (yes(i))
{
cout << i << '\n';
break;
}
}
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... |