Submission #940141

# Submission time Handle Problem Language Result Execution time Memory
940141 2024-03-07T05:55:08 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
1000 ms 600 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 = 1e5 + 4;

int k, b[N];

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];
    }

    for (int i = 1; i < N; i++) {
        bool ok = true;
        for (int j = 0; j < k; j++) ok &= have(i + j, b[j]);
        if (ok) {
            cout << i;
            return;
        }
    }

    while (1){}
}

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

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

    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 6 ms 464 KB Output is correct
15 Correct 6 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 344 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 0 ms 348 KB Output is correct
7 Correct 26 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Execution timed out 1086 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Execution timed out 1036 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Execution timed out 1030 ms 600 KB Time limit exceeded
6 Halted 0 ms 0 KB -