# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
711777 | 2023-03-17T13:41:36 Z | stevancv | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 240 ms | 262144 KB |
#include <bits/stdc++.h> #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 1e5 + 2; const int M = 1e7 + 2; const int inf = 2e9; vector<int> primes[M]; int idx[M], ans[N], koji[M], dp[M]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, q; cin >> n >> q; multiset<pair<int, int>> s; for (int i = 0; i < n; i++) { int x; cin >> x; s.insert({0, x}); for (int j = x; j < M; j += x) primes[j].push_back(x); } for (int i = 1; i <= q; i++) { int x; cin >> x; idx[x] = i; } for (int i = 1; i < M; i++) { dp[i] = inf; for (int j : primes[i]) { s.erase({koji[j], j}); } if (!s.empty()) dp[i] = s.begin()->first + 1; if (idx[i] != 0) ans[idx[i]] = dp[i]; for (int j : primes[i]) { s.insert({dp[i], j}); koji[j] = dp[i]; } } for (int i = 1; i <= q; i++) { if (ans[i] >= inf) cout << "oo" << en; else cout << ans[i] << en; } return 0; }
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 152 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 126 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 204 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 137 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 143 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 132 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 240 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 129 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 126 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 124 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 183 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 214 ms | 262144 KB | Execution killed with signal 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 220 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 155 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 133 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 193 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 125 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 132 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 128 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 154 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 139 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 125 ms | 262144 KB | Execution killed with signal 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 124 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 128 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 145 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 229 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 138 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 136 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 122 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 127 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 126 ms | 262144 KB | Execution killed with signal 9 |
19 | Runtime error | 124 ms | 262144 KB | Execution killed with signal 9 |
20 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
21 | Runtime error | 135 ms | 262144 KB | Execution killed with signal 9 |
22 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
23 | Runtime error | 229 ms | 262144 KB | Execution killed with signal 9 |
24 | Runtime error | 145 ms | 262144 KB | Execution killed with signal 9 |
25 | Runtime error | 125 ms | 262144 KB | Execution killed with signal 9 |
26 | Runtime error | 120 ms | 262144 KB | Execution killed with signal 9 |
27 | Runtime error | 126 ms | 262144 KB | Execution killed with signal 9 |
28 | Runtime error | 133 ms | 262144 KB | Execution killed with signal 9 |
29 | Runtime error | 139 ms | 262144 KB | Execution killed with signal 9 |
30 | Runtime error | 142 ms | 262144 KB | Execution killed with signal 9 |
31 | Runtime error | 137 ms | 262144 KB | Execution killed with signal 9 |
32 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
33 | Runtime error | 171 ms | 262144 KB | Execution killed with signal 9 |
34 | Runtime error | 144 ms | 262144 KB | Execution killed with signal 9 |
35 | Runtime error | 127 ms | 262144 KB | Execution killed with signal 9 |
36 | Runtime error | 117 ms | 262144 KB | Execution killed with signal 9 |
37 | Runtime error | 225 ms | 262144 KB | Execution killed with signal 9 |
38 | Runtime error | 123 ms | 262144 KB | Execution killed with signal 9 |
39 | Runtime error | 148 ms | 262144 KB | Execution killed with signal 9 |
40 | Runtime error | 121 ms | 262144 KB | Execution killed with signal 9 |
41 | Runtime error | 118 ms | 262144 KB | Execution killed with signal 9 |
42 | Runtime error | 115 ms | 262144 KB | Execution killed with signal 9 |