Submission #938278

# Submission time Handle Problem Language Result Execution time Memory
938278 2024-03-05T04:03:07 Z Faisal_Saqib Sequence (BOI14_sequence) C++17
0 / 100
62 ms 348 KB
#include <iostream>
#include <string>
#include <set>
using namespace std;
bool is_in(int x,int y)
{
    string s=to_string(x);
    string yp="";
    yp+=char(y+'0');
    return s.find(yp)!=string::npos;
}
int main()
{
    int n;
    cin>>n;
    int b[n];
    set<int> sp;
    for(int i=0;i<n;i++)
    {
        cin>>b[i];
        // b[i]=9;
        sp.insert(b[i]);
    }
    if(sp.size()==1)
    {
        int tp=1;
        while((tp*10)<=n)
        {
            tp*=10;
        }
        if(tp!=n)
            tp*=10;
        if(b[0] and tp>1)
        {
            cout<<(((tp*10)-1)/9)*8+1<<endl;
        }
        else{
            cout<<tp*b[0]<<endl;

        }
        return 0;
    }
    for(int ans=1;ans<=1e6;ans++)
    {
        bool pos=1;
        for(int j=0;j<n;j++)
        {
            if(!is_in(ans+j,b[j]))
                {
                    pos=0;
                    break;
                }   
        }
        if(pos)
        {
            cout<<ans<<endl;
            break;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Incorrect 0 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 62 ms 344 KB Output isn't correct
6 Halted 0 ms 0 KB -