# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
816302 | 2023-08-09T04:44:12 Z | QwertyPi | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 1000 ms | 114160 KB |
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") using namespace std; const int MAXN = 1e7 + 11; const int MAXM = 1e5 + 11; int p[MAXM]; int lp[MAXN], dp[MAXN], c[MAXN], c2[MAXN], cm = 0; int32_t main(){ cin.tie(0); cout.tie(0)->sync_with_stdio(false); int n, Q; cin >> n >> Q; for(int i = 0; i < n; i++) cin >> p[i]; sort(p, p + n); for(int i = 0; i < n; i++){ for(int j = p[i]; j < MAXN; j += p[i]){ if(!lp[j]) lp[j] = p[i]; } } dp[1] = 0; c2[0] = n; cm = 0; for(int i = 2; i < MAXN; i++){ int x = i; while(lp[x] != 0){ if(lp[x] != lp[x / lp[x]]){ c2[c[lp[x]]]--; while(cm < MAXN - 1 && c2[cm] == 0) cm++; } x /= lp[x]; } int cur = cm; x = i; while(lp[x] != 0){ if(lp[x] != lp[x / lp[x]]){ c[lp[x]] = cur + 1; c2[cur + 1]++; } x /= lp[x]; } dp[i] = cur + 1; } for(int i = 0; i < Q; i++){ int k; cin >> k; cout << (dp[k] != MAXN ? to_string(dp[k]) : "oo") << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 78 ms | 78664 KB | Output is correct |
2 | Correct | 395 ms | 78616 KB | Output is correct |
3 | Correct | 292 ms | 78636 KB | Output is correct |
4 | Correct | 70 ms | 78632 KB | Output is correct |
5 | Correct | 119 ms | 79232 KB | Output is correct |
6 | Correct | 80 ms | 78560 KB | Output is correct |
7 | Correct | 294 ms | 78612 KB | Output is correct |
8 | Correct | 449 ms | 78720 KB | Output is correct |
9 | Correct | 546 ms | 79652 KB | Output is correct |
10 | Correct | 581 ms | 78936 KB | Output is correct |
11 | Correct | 327 ms | 78924 KB | Output is correct |
12 | Correct | 56 ms | 78592 KB | Output is correct |
13 | Correct | 854 ms | 78536 KB | Output is correct |
14 | Incorrect | 873 ms | 78620 KB | Output isn't correct |
15 | Correct | 369 ms | 78612 KB | Output is correct |
16 | Correct | 399 ms | 78616 KB | Output is correct |
17 | Incorrect | 109 ms | 78668 KB | Output isn't correct |
18 | Correct | 86 ms | 78604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 83 ms | 82160 KB | Output is correct |
2 | Correct | 127 ms | 114156 KB | Output is correct |
3 | Correct | 917 ms | 82696 KB | Output is correct |
4 | Correct | 155 ms | 78924 KB | Output is correct |
5 | Correct | 476 ms | 83844 KB | Output is correct |
6 | Correct | 272 ms | 78848 KB | Output is correct |
7 | Correct | 82 ms | 82164 KB | Output is correct |
8 | Correct | 137 ms | 78644 KB | Output is correct |
9 | Correct | 555 ms | 83940 KB | Output is correct |
10 | Correct | 976 ms | 82868 KB | Output is correct |
11 | Correct | 909 ms | 80656 KB | Output is correct |
12 | Correct | 442 ms | 78708 KB | Output is correct |
13 | Correct | 98 ms | 80460 KB | Output is correct |
14 | Correct | 144 ms | 78884 KB | Output is correct |
15 | Correct | 773 ms | 81820 KB | Output is correct |
16 | Correct | 135 ms | 114160 KB | Output is correct |
17 | Correct | 821 ms | 78700 KB | Output is correct |
18 | Correct | 608 ms | 86864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 846 ms | 82800 KB | Output is correct |
2 | Correct | 946 ms | 81584 KB | Output is correct |
3 | Correct | 957 ms | 81520 KB | Output is correct |
4 | Correct | 529 ms | 79176 KB | Output is correct |
5 | Correct | 139 ms | 96460 KB | Output is correct |
6 | Correct | 725 ms | 79480 KB | Output is correct |
7 | Correct | 309 ms | 87996 KB | Output is correct |
8 | Correct | 838 ms | 82784 KB | Output is correct |
9 | Correct | 863 ms | 82744 KB | Output is correct |
10 | Correct | 407 ms | 79024 KB | Output is correct |
11 | Correct | 271 ms | 79064 KB | Output is correct |
12 | Correct | 679 ms | 78956 KB | Output is correct |
13 | Correct | 824 ms | 80492 KB | Output is correct |
14 | Correct | 633 ms | 79472 KB | Output is correct |
15 | Correct | 841 ms | 78984 KB | Output is correct |
16 | Correct | 883 ms | 78980 KB | Output is correct |
17 | Correct | 501 ms | 81880 KB | Output is correct |
18 | Correct | 941 ms | 81548 KB | Output is correct |
19 | Correct | 164 ms | 81308 KB | Output is correct |
20 | Correct | 961 ms | 81500 KB | Output is correct |
21 | Correct | 716 ms | 79272 KB | Output is correct |
22 | Correct | 932 ms | 84956 KB | Output is correct |
23 | Correct | 123 ms | 82840 KB | Output is correct |
24 | Correct | 103 ms | 79208 KB | Output is correct |
25 | Correct | 440 ms | 79012 KB | Output is correct |
26 | Correct | 511 ms | 79232 KB | Output is correct |
27 | Execution timed out | 1014 ms | 84188 KB | Time limit exceeded |
28 | Correct | 137 ms | 79344 KB | Output is correct |
29 | Correct | 500 ms | 84984 KB | Output is correct |
30 | Correct | 410 ms | 82888 KB | Output is correct |
31 | Correct | 161 ms | 79948 KB | Output is correct |
32 | Correct | 196 ms | 79168 KB | Output is correct |
33 | Correct | 90 ms | 79592 KB | Output is correct |
34 | Correct | 331 ms | 88132 KB | Output is correct |
35 | Correct | 151 ms | 79272 KB | Output is correct |
36 | Correct | 946 ms | 84964 KB | Output is correct |
37 | Correct | 158 ms | 96504 KB | Output is correct |
38 | Correct | 727 ms | 79340 KB | Output is correct |
39 | Correct | 119 ms | 79352 KB | Output is correct |
40 | Correct | 615 ms | 79600 KB | Output is correct |
41 | Correct | 536 ms | 92016 KB | Output is correct |
42 | Correct | 898 ms | 79072 KB | Output is correct |