Submission #352618

# Submission time Handle Problem Language Result Execution time Memory
352618 2021-01-21T03:08:50 Z MilosMilutinovic Sequence (BOI14_sequence) C++14
9 / 100
5 ms 620 KB
#include <bits/stdc++.h>
using namespace std;
const int N=100050;
int n,a[N];
auto Do(int x){
    vector<int> a;
    while(x){
        a.push_back(x%10);
        x/=10;
    }
    return a;
}
int main(){
    scanf("%i",&n);
    for(int i=0;i<n;i++)scanf("%i",&a[i]);
    for(int i=0;i<=1000;i++){
        bool ok=1;
        for(int j=0;j<n;j++){
            auto dgt=Do(i+j);
            bool have=0;
            for(int c:dgt)if(c==a[j])have=1;
            if(!have){
                ok=0;
                break;
            }
        }
        if(ok){
            printf("%i",i);
            return 0;
        }
    }
    return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
sequence.cpp:15:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |     for(int i=0;i<n;i++)scanf("%i",&a[i]);
      |                         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 3 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 5 ms 620 KB Output isn't correct
6 Halted 0 ms 0 KB -