Submission #940416

# Submission time Handle Problem Language Result Execution time Memory
940416 2024-03-07T09:01:35 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
259 ms 84100 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "debug.h"
#else
#define debug(...) 0
#endif

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

#define pb push_back
#define i2 array<int, 2>
#define ll long long

const int N = 1e6 + 4;

int k, b[N], f[N][10];

bool have(int x, int d) {
    while (x) {
        if (x % 10 == d) {
            return 1;
        }
        x /= 10;
    }
    return 0;
}

void solve() {
    cin >> k;
    for (int i = 0; i < k; i++) {
        cin >> b[i];
    }

    int n = 1;
    while (1) {
        bool ok = 1;
        if (have(n + k - 1, b[k - 1])) {
            for (int j = 0; j < k; j++) {
                ok &= f[n + j][b[j]];
                if (ok == 0) {
                    break;
                }
            }
            if (ok) {
                cout << n << '\n';
                return;
            }
        }
        n++;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    for (int i = 1; i < N; i++) {
        for (int j = 0; j < 10; j++) {
            f[i][j] = have(i, j);
        }
    }

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 84 ms 39508 KB Output is correct
2 Correct 84 ms 39504 KB Output is correct
3 Correct 84 ms 39588 KB Output is correct
4 Correct 84 ms 39572 KB Output is correct
5 Correct 84 ms 39572 KB Output is correct
6 Correct 84 ms 39560 KB Output is correct
7 Correct 86 ms 39804 KB Output is correct
8 Correct 83 ms 39836 KB Output is correct
9 Correct 83 ms 39560 KB Output is correct
10 Correct 85 ms 39508 KB Output is correct
11 Correct 84 ms 39504 KB Output is correct
12 Correct 83 ms 39504 KB Output is correct
13 Correct 83 ms 39504 KB Output is correct
14 Correct 84 ms 39508 KB Output is correct
15 Correct 84 ms 39504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 39568 KB Output is correct
2 Correct 84 ms 39592 KB Output is correct
3 Correct 85 ms 39572 KB Output is correct
4 Correct 83 ms 39508 KB Output is correct
5 Correct 87 ms 39564 KB Output is correct
6 Correct 89 ms 39588 KB Output is correct
7 Correct 89 ms 39584 KB Output is correct
8 Correct 85 ms 39508 KB Output is correct
9 Correct 90 ms 39504 KB Output is correct
10 Correct 83 ms 39504 KB Output is correct
11 Runtime error 157 ms 79764 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 83 ms 39508 KB Output is correct
2 Correct 86 ms 41556 KB Output is correct
3 Correct 210 ms 41556 KB Output is correct
4 Correct 86 ms 41608 KB Output is correct
5 Runtime error 259 ms 84100 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 39568 KB Output is correct
2 Correct 84 ms 39576 KB Output is correct
3 Correct 84 ms 39508 KB Output is correct
4 Correct 83 ms 39560 KB Output is correct
5 Runtime error 138 ms 84052 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -