답안 #1069046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069046 2024-08-21T15:13:55 Z ortsac Brunhilda’s Birthday (BOI13_brunhilda) C++17
14.7619 / 100
1000 ms 40648 KB
#include <bits/stdc++.h>
 
using namespace std;

int inf = 0x3f3f3f3f;
const int MAXN = 1e7;
int dp[MAXN + 10];

int32_t main() {
    int n, q;
    cin >> n >> q;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int i = 1; i <= MAXN; i++) {
        dp[i] = inf;
        for (auto u : v) dp[i] = min(dp[i], dp[i - (i % u)] + 1);
    }
    while (q--) {
        int x;
        cin >> x;
        if (dp[x] == inf) cout << "oo\n";
        else cout << dp[x] << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 39508 KB Output is correct
2 Correct 821 ms 39520 KB Output is correct
3 Correct 117 ms 39508 KB Output is correct
4 Execution timed out 1037 ms 25936 KB Time limit exceeded
5 Correct 211 ms 39504 KB Output is correct
6 Correct 73 ms 39312 KB Output is correct
7 Correct 126 ms 39528 KB Output is correct
8 Correct 143 ms 39524 KB Output is correct
9 Correct 228 ms 39528 KB Output is correct
10 Correct 425 ms 39528 KB Output is correct
11 Correct 428 ms 39540 KB Output is correct
12 Execution timed out 1020 ms 21072 KB Time limit exceeded
13 Execution timed out 1069 ms 2508 KB Time limit exceeded
14 Execution timed out 1064 ms 2644 KB Time limit exceeded
15 Correct 638 ms 39508 KB Output is correct
16 Correct 834 ms 39504 KB Output is correct
17 Execution timed out 1038 ms 39288 KB Time limit exceeded
18 Execution timed out 1085 ms 26440 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1002 ms 696 KB Time limit exceeded
2 Execution timed out 1038 ms 1416 KB Time limit exceeded
3 Execution timed out 1012 ms 1092 KB Time limit exceeded
4 Execution timed out 1026 ms 980 KB Time limit exceeded
5 Execution timed out 1012 ms 856 KB Time limit exceeded
6 Execution timed out 1042 ms 2004 KB Time limit exceeded
7 Execution timed out 1067 ms 852 KB Time limit exceeded
8 Execution timed out 1094 ms 2420 KB Time limit exceeded
9 Execution timed out 1049 ms 1208 KB Time limit exceeded
10 Execution timed out 1030 ms 1112 KB Time limit exceeded
11 Execution timed out 1047 ms 864 KB Time limit exceeded
12 Execution timed out 1022 ms 1360 KB Time limit exceeded
13 Execution timed out 1056 ms 1108 KB Time limit exceeded
14 Execution timed out 1062 ms 904 KB Time limit exceeded
15 Execution timed out 1033 ms 892 KB Time limit exceeded
16 Execution timed out 1059 ms 1620 KB Time limit exceeded
17 Execution timed out 1025 ms 1108 KB Time limit exceeded
18 Execution timed out 1030 ms 1616 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 1132 KB Time limit exceeded
2 Execution timed out 1061 ms 1364 KB Time limit exceeded
3 Execution timed out 1008 ms 1136 KB Time limit exceeded
4 Execution timed out 1039 ms 1104 KB Time limit exceeded
5 Execution timed out 1048 ms 1620 KB Time limit exceeded
6 Execution timed out 1055 ms 760 KB Time limit exceeded
7 Execution timed out 1049 ms 1624 KB Time limit exceeded
8 Execution timed out 1063 ms 1124 KB Time limit exceeded
9 Execution timed out 1046 ms 1112 KB Time limit exceeded
10 Execution timed out 1004 ms 704 KB Time limit exceeded
11 Execution timed out 1036 ms 824 KB Time limit exceeded
12 Execution timed out 1086 ms 828 KB Time limit exceeded
13 Execution timed out 1048 ms 856 KB Time limit exceeded
14 Correct 746 ms 40648 KB Output is correct
15 Execution timed out 1062 ms 2644 KB Time limit exceeded
16 Execution timed out 1052 ms 868 KB Time limit exceeded
17 Execution timed out 1028 ms 856 KB Time limit exceeded
18 Execution timed out 1064 ms 1028 KB Time limit exceeded
19 Execution timed out 1047 ms 904 KB Time limit exceeded
20 Execution timed out 1075 ms 1132 KB Time limit exceeded
21 Execution timed out 1052 ms 19968 KB Time limit exceeded
22 Execution timed out 1072 ms 1712 KB Time limit exceeded
23 Execution timed out 1044 ms 860 KB Time limit exceeded
24 Execution timed out 1010 ms 2640 KB Time limit exceeded
25 Execution timed out 1082 ms 1036 KB Time limit exceeded
26 Execution timed out 1085 ms 1080 KB Time limit exceeded
27 Execution timed out 1064 ms 1968 KB Time limit exceeded
28 Execution timed out 1087 ms 2376 KB Time limit exceeded
29 Execution timed out 1064 ms 1704 KB Time limit exceeded
30 Execution timed out 1033 ms 1344 KB Time limit exceeded
31 Execution timed out 1057 ms 852 KB Time limit exceeded
32 Execution timed out 1030 ms 1240 KB Time limit exceeded
33 Execution timed out 1070 ms 1820 KB Time limit exceeded
34 Execution timed out 1063 ms 1588 KB Time limit exceeded
35 Execution timed out 1049 ms 1256 KB Time limit exceeded
36 Execution timed out 1008 ms 1664 KB Time limit exceeded
37 Execution timed out 1014 ms 1700 KB Time limit exceeded
38 Execution timed out 1044 ms 960 KB Time limit exceeded
39 Execution timed out 1090 ms 2640 KB Time limit exceeded
40 Execution timed out 1055 ms 852 KB Time limit exceeded
41 Execution timed out 1086 ms 1700 KB Time limit exceeded
42 Execution timed out 1079 ms 2644 KB Time limit exceeded