# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1126702 | KasymK | Sequence (BOI14_sequence) | C++20 | 74 ms | 584 KiB |
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 1e5+5;
int v[N];
vector<int> take(int x){
vector<int> ret;
while(x)
ret.pb(x%10), x/=10;
return ret;
}
int main(){
int k;
scanf("%d", &k);
for(int i = 1; i <= k; ++i)
scanf("%d", v+i);
if(k<=1000){
for(int ad = 0; ad <= 1000; ++ad){
bool plz = 1;
for(int i = 1; i <= k; ++i){
vector<int> A = take(ad+i-1);
bool did = 0;
for(int j = 0; j < (int)A.size() and !did; ++j)
if(A[j]==v[i])
did=1;
plz &= did;
}
if(plz){
printf("%d\n", ad);
exit(0);
}
}
}
int ad = v[1];
if(ad>=1 and ad<=8){
printf("%d", ad);
int mal = ceil(log10(k));
while(mal--)
printf("0");
puts("");
return 0;
}
int x = 0, sm = 0;
while(1){
sm += pow(10, x);
if(sm >= k)
break;
x++;
}
if(ad==9){
while(x--)
printf("8");
printf("9\n");
return 0;
}
assert(ad==0);
printf("1");
x++;
while(x--)
printf("0");
puts("");
return 0;
}
Compilation message (stderr)
# | 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... |