답안 #865567

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865567 2023-10-24T10:58:37 Z azimanov 수열 (BOI14_sequence) C++17
9 / 100
1000 ms 4596 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

bool getbit(int mask, int bit) {
    return mask & (1 << bit);
}

const int N = 1e6 + 10;
const int K = 1e5 + 10;
int b[K];
int mask[N];

void init() {
    mask[0] = (1 << 0);
    for (int i = 1; i <= N - 1; i++) {
        for (int j = i; j >= 1; j /= 10) {
            mask[i] |= (1 << (j % 10));
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    init();

    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        cin >> b[i];
    }
    int ans = -1;
    for (int n = 1; n + k - 1 <= N - 1; n++) {
        bool ok = true;
        for (int i = 1; i <= k; i++) {
            ok &= getbit(mask[n + i - 1], b[i]);
        }
        if (ok) {
            ans = n;
            break;
        }
    }
    cout << ans << "\n";

#ifdef LOCAL
    cout << "\nTime elapsed: " << double(clock()) / CLOCKS_PER_SEC << " s.\n";
#endif
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4188 KB Output is correct
2 Correct 7 ms 4188 KB Output is correct
3 Correct 7 ms 4320 KB Output is correct
4 Correct 7 ms 4188 KB Output is correct
5 Correct 7 ms 4280 KB Output is correct
6 Correct 7 ms 4184 KB Output is correct
7 Correct 7 ms 4184 KB Output is correct
8 Correct 8 ms 4188 KB Output is correct
9 Correct 7 ms 4184 KB Output is correct
10 Correct 7 ms 4188 KB Output is correct
11 Correct 7 ms 4344 KB Output is correct
12 Correct 7 ms 4596 KB Output is correct
13 Correct 7 ms 4364 KB Output is correct
14 Correct 8 ms 4140 KB Output is correct
15 Correct 8 ms 4188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4188 KB Output is correct
2 Correct 7 ms 4188 KB Output is correct
3 Correct 7 ms 4276 KB Output is correct
4 Correct 7 ms 4188 KB Output is correct
5 Correct 7 ms 4128 KB Output is correct
6 Correct 7 ms 4440 KB Output is correct
7 Correct 12 ms 4372 KB Output is correct
8 Correct 7 ms 4188 KB Output is correct
9 Correct 9 ms 4440 KB Output is correct
10 Correct 7 ms 4188 KB Output is correct
11 Incorrect 500 ms 4300 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4184 KB Output is correct
2 Correct 492 ms 4420 KB Output is correct
3 Execution timed out 1096 ms 4184 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 4188 KB Output is correct
2 Correct 7 ms 4248 KB Output is correct
3 Correct 7 ms 4188 KB Output is correct
4 Correct 7 ms 4188 KB Output is correct
5 Execution timed out 1075 ms 4380 KB Time limit exceeded
6 Halted 0 ms 0 KB -