Submission #734600

# Submission time Handle Problem Language Result Execution time Memory
734600 2023-05-02T17:03:07 Z DAleksa Brunhilda’s Birthday (BOI13_brunhilda) C++17
0 / 100
15 ms 2256 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e2 + 10;
int n, q;
vector<int> p;
vector<int> v;
int prime[N];
int prv[N];
int dp[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> q;
    p.resize(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    for(int i : p) {
        for(int j = i; j < N; j += i) {
            v.push_back(j);
            prime[j] = max(prime[j], i);
        }
    }
    v.push_back(0);
    prime[0] = p.back();
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    int j = 0;
    for(int i = 1; i < N; i++) {
        while(v[j] + prime[v[j]] <= i) j++;
        prv[i] = v[j];
    }
    for(int i = 1; i < N; i++) {
        if(prv[i] == i) dp[i] = -1;
        else dp[i] = dp[prv[i]] + 1;
    }
    while(q--) {
        int x;
        cin >> x;
        if(dp[x] == -1) cout << "oo\n";
        else cout << dp[x] << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Runtime error 1 ms 448 KB Execution killed with signal 11
4 Runtime error 3 ms 460 KB Execution killed with signal 11
5 Incorrect 1 ms 212 KB Output isn't correct
6 Runtime error 1 ms 468 KB Execution killed with signal 11
7 Runtime error 1 ms 444 KB Execution killed with signal 11
8 Runtime error 1 ms 452 KB Execution killed with signal 11
9 Incorrect 1 ms 212 KB Output isn't correct
10 Runtime error 1 ms 468 KB Execution killed with signal 11
11 Runtime error 1 ms 452 KB Execution killed with signal 11
12 Incorrect 1 ms 320 KB Output isn't correct
13 Runtime error 1 ms 460 KB Execution killed with signal 11
14 Runtime error 3 ms 468 KB Execution killed with signal 11
15 Runtime error 1 ms 448 KB Execution killed with signal 11
16 Runtime error 1 ms 448 KB Execution killed with signal 11
17 Runtime error 2 ms 464 KB Execution killed with signal 11
18 Runtime error 2 ms 464 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 592 KB Execution killed with signal 11
2 Runtime error 11 ms 1828 KB Execution killed with signal 11
3 Runtime error 7 ms 1480 KB Execution killed with signal 11
4 Runtime error 1 ms 464 KB Execution killed with signal 11
5 Runtime error 5 ms 1236 KB Execution killed with signal 11
6 Runtime error 1 ms 468 KB Execution killed with signal 11
7 Runtime error 2 ms 584 KB Execution killed with signal 11
8 Runtime error 1 ms 468 KB Execution killed with signal 11
9 Runtime error 8 ms 1492 KB Execution killed with signal 11
10 Runtime error 7 ms 1484 KB Execution killed with signal 11
11 Runtime error 5 ms 972 KB Execution killed with signal 11
12 Runtime error 1 ms 456 KB Execution killed with signal 11
13 Runtime error 1 ms 464 KB Execution killed with signal 11
14 Runtime error 1 ms 468 KB Execution killed with signal 11
15 Runtime error 4 ms 980 KB Execution killed with signal 11
16 Runtime error 10 ms 1836 KB Execution killed with signal 11
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Runtime error 10 ms 2004 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1364 KB Execution killed with signal 11
2 Runtime error 6 ms 1364 KB Execution killed with signal 11
3 Runtime error 8 ms 1280 KB Execution killed with signal 11
4 Runtime error 2 ms 572 KB Execution killed with signal 11
5 Runtime error 10 ms 2256 KB Execution killed with signal 11
6 Runtime error 2 ms 724 KB Execution killed with signal 11
7 Runtime error 10 ms 2116 KB Execution killed with signal 11
8 Runtime error 5 ms 1364 KB Execution killed with signal 11
9 Runtime error 6 ms 1364 KB Execution killed with signal 11
10 Runtime error 2 ms 596 KB Execution killed with signal 11
11 Runtime error 2 ms 596 KB Execution killed with signal 11
12 Runtime error 2 ms 596 KB Execution killed with signal 11
13 Runtime error 4 ms 1060 KB Execution killed with signal 11
14 Runtime error 2 ms 468 KB Execution killed with signal 11
15 Runtime error 2 ms 596 KB Execution killed with signal 11
16 Runtime error 2 ms 724 KB Execution killed with signal 11
17 Runtime error 5 ms 1232 KB Execution killed with signal 11
18 Runtime error 5 ms 1360 KB Execution killed with signal 11
19 Runtime error 1 ms 584 KB Execution killed with signal 11
20 Runtime error 5 ms 1284 KB Execution killed with signal 11
21 Runtime error 1 ms 464 KB Execution killed with signal 11
22 Runtime error 10 ms 2120 KB Execution killed with signal 11
23 Runtime error 4 ms 1064 KB Execution killed with signal 11
24 Runtime error 1 ms 468 KB Execution killed with signal 11
25 Runtime error 1 ms 596 KB Execution killed with signal 11
26 Runtime error 2 ms 596 KB Execution killed with signal 11
27 Runtime error 10 ms 2120 KB Execution killed with signal 11
28 Runtime error 1 ms 468 KB Execution killed with signal 11
29 Runtime error 10 ms 2132 KB Execution killed with signal 11
30 Runtime error 7 ms 1620 KB Execution killed with signal 11
31 Runtime error 2 ms 588 KB Execution killed with signal 11
32 Runtime error 1 ms 596 KB Execution killed with signal 11
33 Runtime error 1 ms 464 KB Execution killed with signal 11
34 Runtime error 9 ms 2124 KB Execution killed with signal 11
35 Runtime error 1 ms 596 KB Execution killed with signal 11
36 Runtime error 8 ms 2000 KB Execution killed with signal 11
37 Runtime error 10 ms 2256 KB Execution killed with signal 11
38 Runtime error 2 ms 724 KB Execution killed with signal 11
39 Runtime error 1 ms 572 KB Execution killed with signal 11
40 Runtime error 2 ms 724 KB Execution killed with signal 11
41 Runtime error 15 ms 2256 KB Execution killed with signal 11
42 Runtime error 1 ms 596 KB Execution killed with signal 11