# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136071 | forelax | Sequence (BOI14_sequence) | C++14 | 13 ms | 504 KiB |
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<bits/stdc++.h>
using namespace std;
vector<bool> digs(int ind){
vector<bool> rez(10);
do{
rez[ind%10]=true;
}while(ind/=10);
return rez;
}
int n;
vector<int> v;
int main(){
cin>>n;
v.resize(n);
vector<int> g(10);
for(int i = 0 ; i < n ; i ++){
cin>>v[i];
g[v[i]]++;
}
int t=0,td;
for(int i = 0 ; i < g.size() ; i ++)
if(g[i]){
t++;
td=i;
}
if(t==1){
int rez=0;
while(true){
bool good=true;
for(int k = 0 ; k < n ; k ++){
if(!digs(rez+k)[td]){
rez+=k+1;
good=false;
}
}
if(good)
break;
}
cout<<rez;
return 0;
}
for(int i = 1 ; i <= 1000 ; i ++){
bool good=true;
for(int k = 0 ; k < n ; k ++){
if(!digs(i+k)[v[k]]){
good=false;
break;
}
}
if(good){
cout<<i;
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... |