Submission #1109629

# Submission time Handle Problem Language Result Execution time Memory
1109629 2024-11-07T07:55:46 Z qrn Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
1000 ms 1392 KB
#include <bits/stdc++.h>
using namespace std;

#define SPEED ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);


#define int long long
#define endl "\n"
#define ALL(X) X.begin(), X.end()

const int sz = 10005, inf = 1e9;

vector<int>dp(sz, inf);

void solve() {
    int m, qq;
    cin >> m >> qq;
    vector<int> p(m);
    for(int i = 0; i < m; i++) cin >> p[i];
    dp[0] = 0;
    for(int i = 1; i <= sz; i++) {
        int mini = inf;
        for(int j = 0; j < m; j++) {
            mini = min(mini, dp[i - (i % p[j])]);
        }
        dp[i] = mini + 1;   
    }
    while(qq--) {
        int q;
        cin >> q;
        if(dp[q] == inf + 1) {
            cout << "oo" << endl;
        }
        else {
            cout << dp[q] << endl;
        }
    }
}

signed main() {
    SPEED;
    int tst = 1;
    // cin >> tst;
    while(tst--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 6
2 Runtime error 2 ms 592 KB Execution killed with signal 6
3 Runtime error 1 ms 592 KB Execution killed with signal 6
4 Runtime error 4 ms 596 KB Execution killed with signal 6
5 Runtime error 2 ms 592 KB Execution killed with signal 6
6 Runtime error 2 ms 592 KB Execution killed with signal 6
7 Runtime error 2 ms 592 KB Execution killed with signal 6
8 Runtime error 2 ms 592 KB Execution killed with signal 6
9 Runtime error 2 ms 592 KB Execution killed with signal 6
10 Runtime error 2 ms 592 KB Execution killed with signal 6
11 Runtime error 2 ms 592 KB Execution killed with signal 6
12 Runtime error 4 ms 592 KB Execution killed with signal 6
13 Runtime error 24 ms 548 KB Execution killed with signal 6
14 Runtime error 26 ms 820 KB Execution killed with signal 6
15 Runtime error 2 ms 592 KB Execution killed with signal 6
16 Runtime error 3 ms 544 KB Execution killed with signal 6
17 Runtime error 3 ms 592 KB Execution killed with signal 6
18 Runtime error 4 ms 592 KB Execution killed with signal 6
# Verdict Execution time Memory Grader output
1 Runtime error 278 ms 840 KB Execution killed with signal 11
2 Execution timed out 1068 ms 1104 KB Time limit exceeded
3 Execution timed out 1044 ms 848 KB Time limit exceeded
4 Runtime error 73 ms 552 KB Execution killed with signal 11
5 Execution timed out 1076 ms 848 KB Time limit exceeded
6 Runtime error 29 ms 552 KB Execution killed with signal 11
7 Runtime error 278 ms 840 KB Execution killed with signal 11
8 Runtime error 24 ms 592 KB Execution killed with signal 11
9 Execution timed out 1062 ms 848 KB Time limit exceeded
10 Execution timed out 1045 ms 848 KB Time limit exceeded
11 Runtime error 935 ms 1356 KB Execution killed with signal 11
12 Runtime error 50 ms 584 KB Execution killed with signal 11
13 Runtime error 69 ms 592 KB Execution killed with signal 11
14 Runtime error 73 ms 556 KB Execution killed with signal 11
15 Runtime error 965 ms 1376 KB Execution killed with signal 11
16 Execution timed out 1053 ms 1104 KB Time limit exceeded
17 Runtime error 70 ms 548 KB Execution killed with signal 11
18 Execution timed out 1071 ms 1272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 848 KB Time limit exceeded
2 Execution timed out 1073 ms 848 KB Time limit exceeded
3 Execution timed out 1071 ms 848 KB Time limit exceeded
4 Runtime error 80 ms 552 KB Execution killed with signal 11
5 Execution timed out 1063 ms 1268 KB Time limit exceeded
6 Runtime error 188 ms 840 KB Execution killed with signal 11
7 Execution timed out 1060 ms 1104 KB Time limit exceeded
8 Execution timed out 1078 ms 848 KB Time limit exceeded
9 Execution timed out 1062 ms 848 KB Time limit exceeded
10 Runtime error 137 ms 836 KB Execution killed with signal 11
11 Runtime error 102 ms 584 KB Execution killed with signal 11
12 Runtime error 137 ms 828 KB Execution killed with signal 11
13 Runtime error 691 ms 1096 KB Execution killed with signal 11
14 Runtime error 3 ms 592 KB Execution killed with signal 11
15 Runtime error 128 ms 584 KB Execution killed with signal 11
16 Runtime error 164 ms 856 KB Execution killed with signal 11
17 Execution timed out 1042 ms 1392 KB Time limit exceeded
18 Execution timed out 1053 ms 848 KB Time limit exceeded
19 Runtime error 119 ms 832 KB Execution killed with signal 11
20 Execution timed out 1047 ms 848 KB Time limit exceeded
21 Runtime error 4 ms 592 KB Execution killed with signal 11
22 Execution timed out 1094 ms 1104 KB Time limit exceeded
23 Runtime error 690 ms 1024 KB Execution killed with signal 11
24 Runtime error 28 ms 532 KB Execution killed with signal 11
25 Runtime error 68 ms 584 KB Execution killed with signal 11
26 Runtime error 79 ms 544 KB Execution killed with signal 11
27 Execution timed out 1086 ms 1104 KB Time limit exceeded
28 Runtime error 24 ms 592 KB Execution killed with signal 11
29 Execution timed out 1038 ms 1104 KB Time limit exceeded
30 Execution timed out 1062 ms 848 KB Time limit exceeded
31 Runtime error 102 ms 820 KB Execution killed with signal 11
32 Runtime error 68 ms 584 KB Execution killed with signal 11
33 Runtime error 30 ms 604 KB Execution killed with signal 11
34 Execution timed out 1082 ms 1104 KB Time limit exceeded
35 Runtime error 48 ms 548 KB Execution killed with signal 11
36 Execution timed out 1066 ms 1104 KB Time limit exceeded
37 Execution timed out 1057 ms 1104 KB Time limit exceeded
38 Runtime error 188 ms 840 KB Execution killed with signal 11
39 Runtime error 54 ms 584 KB Execution killed with signal 11
40 Runtime error 218 ms 840 KB Execution killed with signal 11
41 Execution timed out 1060 ms 1104 KB Time limit exceeded
42 Runtime error 70 ms 548 KB Execution killed with signal 11