Submission #940412

# Submission time Handle Problem Language Result Execution time Memory
940412 2024-03-07T09:00:34 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
262 ms 84052 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;
}

// x
# Verdict Execution time Memory Grader output
1 Correct 98 ms 39568 KB Output is correct
2 Correct 86 ms 39592 KB Output is correct
3 Correct 91 ms 39580 KB Output is correct
4 Correct 87 ms 39580 KB Output is correct
5 Correct 86 ms 39552 KB Output is correct
6 Correct 87 ms 39508 KB Output is correct
7 Correct 93 ms 39576 KB Output is correct
8 Correct 85 ms 39584 KB Output is correct
9 Correct 85 ms 39592 KB Output is correct
10 Correct 90 ms 39508 KB Output is correct
11 Correct 86 ms 39584 KB Output is correct
12 Correct 85 ms 39560 KB Output is correct
13 Correct 86 ms 39588 KB Output is correct
14 Correct 88 ms 39584 KB Output is correct
15 Correct 99 ms 39508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 39596 KB Output is correct
2 Correct 93 ms 39508 KB Output is correct
3 Correct 86 ms 39508 KB Output is correct
4 Correct 87 ms 39504 KB Output is correct
5 Correct 88 ms 39568 KB Output is correct
6 Correct 88 ms 39576 KB Output is correct
7 Correct 88 ms 39564 KB Output is correct
8 Correct 102 ms 39564 KB Output is correct
9 Correct 93 ms 39572 KB Output is correct
10 Correct 93 ms 39508 KB Output is correct
11 Runtime error 160 ms 79756 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 86 ms 39580 KB Output is correct
2 Correct 88 ms 41644 KB Output is correct
3 Correct 216 ms 41664 KB Output is correct
4 Correct 90 ms 41556 KB Output is correct
5 Runtime error 262 ms 83988 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 90 ms 39568 KB Output is correct
2 Correct 86 ms 39540 KB Output is correct
3 Correct 85 ms 39560 KB Output is correct
4 Correct 88 ms 39556 KB Output is correct
5 Runtime error 138 ms 84052 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -