이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;
const int MAXN = 100100;
ll arr[MAXN];
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
REP(i, n) cin >> arr[i];
if (n <= 1000) {
REP(k, 1001) {
int good = 1;
REP(i, n) {
int flag = 0, t = k + i;
while (t > 0) {
if (t % 10 == arr[i]) flag = 1;
t /= 10;
}
if (!flag) good = 0;
}
if (good) {
cout << k << "\n";
return 0;
}
}
}
if (arr[0] != 9) {
ll t = 1LL;
while (t < n) t *= 10LL;
if (n % 10 == 0) t /= 10;
if (arr[0] == 0) cout << 10LL * t << "\n";
else cout << arr[0] * t << "\n";
} else {
ll out = 8LL, curr = 1LL, inc = 10LL;
while (curr < n) {
curr += inc;
out = out * 10LL + 8LL;
inc *= 10LL;
}
cout << out + 1 << "\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... |