답안 #940252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940252 2024-03-07T07:09:00 Z NNNNN 수열 (BOI14_sequence) C++17
9 / 100
67 ms 25948 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], sm = true;

int main() {
    ios:: sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] ^ a[0]) sm = false;
    }
    for (int w = 1; w <= 1000000; w++) {
        string s = to_string(w);
        for (auto e : s)
            mark[w][e - '0'] = true;
    }
    if (sm) {
        int l = 1, r = 1;
        while (true) {
            if (r - l == n) return cout << l << '\n', 0;
            if (!mark[r][a[0]]) l = r + 1;
            r++;
        }
        return 0;
    }
    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;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 12888 KB Output is correct
2 Correct 15 ms 12892 KB Output is correct
3 Correct 16 ms 12892 KB Output is correct
4 Correct 16 ms 12948 KB Output is correct
5 Correct 17 ms 12948 KB Output is correct
6 Correct 15 ms 12888 KB Output is correct
7 Correct 16 ms 12892 KB Output is correct
8 Correct 15 ms 12944 KB Output is correct
9 Correct 16 ms 12948 KB Output is correct
10 Correct 15 ms 12888 KB Output is correct
11 Correct 16 ms 12744 KB Output is correct
12 Correct 19 ms 12884 KB Output is correct
13 Correct 16 ms 12948 KB Output is correct
14 Correct 15 ms 12892 KB Output is correct
15 Correct 15 ms 12884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 12936 KB Output is correct
2 Correct 16 ms 12948 KB Output is correct
3 Correct 15 ms 13144 KB Output is correct
4 Correct 18 ms 13160 KB Output is correct
5 Correct 15 ms 12944 KB Output is correct
6 Correct 15 ms 12892 KB Output is correct
7 Correct 15 ms 12892 KB Output is correct
8 Correct 16 ms 12892 KB Output is correct
9 Correct 17 ms 12888 KB Output is correct
10 Correct 15 ms 12888 KB Output is correct
11 Incorrect 67 ms 12888 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 12892 KB Output is correct
2 Correct 16 ms 12888 KB Output is correct
3 Correct 16 ms 12964 KB Output is correct
4 Correct 16 ms 12892 KB Output is correct
5 Runtime error 27 ms 25948 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 12888 KB Output is correct
2 Correct 16 ms 12892 KB Output is correct
3 Correct 20 ms 12892 KB Output is correct
4 Correct 15 ms 12948 KB Output is correct
5 Incorrect 20 ms 12892 KB Output isn't correct
6 Halted 0 ms 0 KB -