Submission #136071

# Submission time Handle Problem Language Result Execution time Memory
136071 2019-07-24T17:07:13 Z forelax Sequence (BOI14_sequence) C++14
0 / 100
13 ms 504 KB
#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

sequence.cpp: In function 'int main()':
sequence.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < g.size() ; i ++)
                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 380 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 13 ms 504 KB Output isn't correct
6 Halted 0 ms 0 KB -