Submission #940266

# Submission time Handle Problem Language Result Execution time Memory
940266 2024-03-07T07:18:36 Z NNNNN Sequence (BOI14_sequence) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;

int n, a[N];
bool mark[10000009][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 <= 10000000; w++) {
        string s = to_string(w);
        for (auto e : s)
            mark[w][e - '0'] = true;
    }
    for (int w = 1; w <= 10000000; 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;
}

Compilation message

sequence.cpp:6:10: error: 'N' was not declared in this scope
    6 | int n, a[N];
      |          ^
sequence.cpp: In function 'int main()':
sequence.cpp:12:40: error: 'a' was not declared in this scope
   12 |     for (int i = 0; i < n; i++) cin >> a[i];
      |                                        ^
sequence.cpp:23:28: error: 'a' was not declared in this scope
   23 |             if (!mark[cnt][a[i]]) {
      |                            ^