Submission #940096

#TimeUsernameProblemLanguageResultExecution timeMemory
940096vjudge1Sequence (BOI14_sequence)C++17
9 / 100
702 ms600 KiB
#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];

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++) {
        int cnt = w;
        bool mark = true;
        for (int i = 0; i < n; i++) {
            if (i) cnt++;
            bool flag = false;
            string s = to_string(cnt);
            for (auto e : s)
                if (e == char(a[i] + '0')) flag = true;
            if (!flag) {
                mark = false;
                break;
            }
        }
        if (mark) {
            cout << w << '\n';
            return 0;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...