Submission #940237

# Submission time Handle Problem Language Result Execution time Memory
940237 2024-03-07T06:51:18 Z NNNNN Sequence (BOI14_sequence) C++17
9 / 100
488 ms 13148 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 10;

int n, a[N];
bool mark[N][11];

int main() {
    ios:: sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int w = 1; w <= 1000000; w++) {
        string s = to_string(w);
        for (auto e : s)
            mark[w][e - '0'] = true;
    }
    for (int w = 1; w <= 1000000; w++) {
        int cnt = w;
        bool flag = true;
        for (int i = 0; i < n; i++) {
            if (i) cnt++;
            if (!mark[cnt][a[i]]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << w << '\n';
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 15 ms 12892 KB Output is correct
2 Correct 16 ms 12836 KB Output is correct
3 Correct 16 ms 12952 KB Output is correct
4 Correct 15 ms 12888 KB Output is correct
5 Correct 19 ms 12892 KB Output is correct
6 Correct 22 ms 12940 KB Output is correct
7 Correct 15 ms 12892 KB Output is correct
8 Correct 22 ms 12936 KB Output is correct
9 Correct 16 ms 12948 KB Output is correct
10 Correct 16 ms 12892 KB Output is correct
11 Correct 15 ms 12936 KB Output is correct
12 Correct 21 ms 12892 KB Output is correct
13 Correct 19 ms 12688 KB Output is correct
14 Correct 18 ms 12892 KB Output is correct
15 Correct 17 ms 12944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 12892 KB Output is correct
2 Correct 16 ms 12892 KB Output is correct
3 Correct 18 ms 12952 KB Output is correct
4 Correct 17 ms 12940 KB Output is correct
5 Correct 18 ms 12936 KB Output is correct
6 Correct 17 ms 12892 KB Output is correct
7 Correct 16 ms 12892 KB Output is correct
8 Correct 17 ms 12892 KB Output is correct
9 Correct 17 ms 12952 KB Output is correct
10 Correct 16 ms 12952 KB Output is correct
11 Incorrect 66 ms 12948 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 12952 KB Output is correct
2 Correct 21 ms 12892 KB Output is correct
3 Correct 444 ms 13148 KB Output is correct
4 Correct 21 ms 12892 KB Output is correct
5 Incorrect 488 ms 12892 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 12892 KB Output is correct
2 Correct 17 ms 12888 KB Output is correct
3 Correct 15 ms 12892 KB Output is correct
4 Correct 16 ms 12948 KB Output is correct
5 Incorrect 21 ms 12948 KB Output isn't correct
6 Halted 0 ms 0 KB -