Submission #940267

# Submission time Handle Problem Language Result Execution time Memory
940267 2024-03-07T07:19:20 Z vjudge1 Sequence (BOI14_sequence) C++17
34 / 100
852 ms 98988 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[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;
}
# Verdict Execution time Memory Grader output
1 Correct 178 ms 98272 KB Output is correct
2 Correct 171 ms 98224 KB Output is correct
3 Correct 166 ms 98192 KB Output is correct
4 Correct 175 ms 98080 KB Output is correct
5 Correct 165 ms 98132 KB Output is correct
6 Correct 167 ms 98032 KB Output is correct
7 Correct 166 ms 98088 KB Output is correct
8 Correct 188 ms 98216 KB Output is correct
9 Correct 168 ms 98132 KB Output is correct
10 Correct 164 ms 98208 KB Output is correct
11 Correct 185 ms 98128 KB Output is correct
12 Correct 164 ms 98132 KB Output is correct
13 Correct 187 ms 98128 KB Output is correct
14 Correct 167 ms 98732 KB Output is correct
15 Correct 167 ms 98284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 167 ms 98128 KB Output is correct
2 Correct 182 ms 98132 KB Output is correct
3 Correct 165 ms 98264 KB Output is correct
4 Correct 168 ms 98048 KB Output is correct
5 Correct 166 ms 98252 KB Output is correct
6 Correct 166 ms 98132 KB Output is correct
7 Correct 165 ms 98216 KB Output is correct
8 Correct 185 ms 98072 KB Output is correct
9 Correct 169 ms 98204 KB Output is correct
10 Correct 166 ms 98204 KB Output is correct
11 Incorrect 852 ms 98280 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 164 ms 98068 KB Output is correct
2 Correct 174 ms 98536 KB Output is correct
3 Correct 552 ms 98324 KB Output is correct
4 Correct 180 ms 98520 KB Output is correct
5 Correct 596 ms 98132 KB Output is correct
6 Correct 166 ms 98236 KB Output is correct
7 Correct 285 ms 98688 KB Output is correct
8 Correct 562 ms 98552 KB Output is correct
9 Correct 407 ms 98792 KB Output is correct
10 Correct 480 ms 98988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 171 ms 98128 KB Output is correct
2 Correct 170 ms 98200 KB Output is correct
3 Correct 169 ms 98128 KB Output is correct
4 Correct 167 ms 98132 KB Output is correct
5 Incorrect 207 ms 98900 KB Output isn't correct
6 Halted 0 ms 0 KB -