이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
int N, A[100001], ans = 0;
bool same = 1;
int main()
{
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> A[i];
if (i) same |= (A[i] == A[i - 1]);
}
if (!same)
{
for (int i = 1; i <= 1000; i++)
{
for (int j = 0; j < N; j++)
{
int c = i + j;
bool exist = 0;
while (c) {exist |= (A[j] == c % 10); c /= 10;}
if (!exist) {break;}
else if (j == N - 1) {ans = i;}
}
if (ans) break;
}
}
else
{
ans = A[0]; N--;
if (!ans) ans = 10;
while (N) {N /= 10; ans *= 10;}
}
cout << ans << "\n";
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... |