답안 #940263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940263 2024-03-07T07:17:29 Z vjudge1 수열 (BOI14_sequence) C++17
9 / 100
51 ms 1552 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;

const int N = 1e5 + 10;

int n, a[N];
bool mark[N][10];

int main() {
    ios:: sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int w = 1; w <= 100000; w++) {
        string s = to_string(w);
        for (auto e : s)
            mark[w][e - '0'] = true;
    }
    for (int w = 1; w <= 100000; 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;
        }
    }
    cout << -1 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 2 ms 1372 KB Output is correct
3 Correct 2 ms 1372 KB Output is correct
4 Correct 2 ms 1368 KB Output is correct
5 Correct 2 ms 1372 KB Output is correct
6 Correct 2 ms 1372 KB Output is correct
7 Correct 2 ms 1372 KB Output is correct
8 Correct 2 ms 1368 KB Output is correct
9 Correct 2 ms 1368 KB Output is correct
10 Correct 2 ms 1368 KB Output is correct
11 Correct 2 ms 1368 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 2 ms 1372 KB Output is correct
14 Correct 2 ms 1368 KB Output is correct
15 Correct 2 ms 1372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 2 ms 1372 KB Output is correct
3 Correct 2 ms 1372 KB Output is correct
4 Correct 2 ms 1372 KB Output is correct
5 Correct 2 ms 1372 KB Output is correct
6 Correct 2 ms 1368 KB Output is correct
7 Correct 2 ms 1372 KB Output is correct
8 Correct 2 ms 1372 KB Output is correct
9 Correct 2 ms 1372 KB Output is correct
10 Correct 2 ms 1372 KB Output is correct
11 Incorrect 4 ms 1372 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 6 ms 1372 KB Output is correct
3 Incorrect 51 ms 1456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 2 ms 1372 KB Output is correct
3 Correct 2 ms 1372 KB Output is correct
4 Correct 2 ms 1372 KB Output is correct
5 Incorrect 4 ms 1552 KB Output isn't correct
6 Halted 0 ms 0 KB -