# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
712214 | 2023-03-18T11:43:45 Z | stevancv | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 694 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 = 1e9; 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; for (int i = 0; i < n; i++) { int x; cin >> x; for (int j = x; j < M / 20; j += x) primes[j].push_back(x); } multiset<int> s; for (int i = 0; i < n; i++) s.insert(0); 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(s.find(koji[j])); } if (!s.empty()) dp[i] = *(s.begin()) + 1; ans[idx[i]] = dp[i]; for (int j : primes[i]) { koji[j] = dp[i]; s.insert(koji[j]); } } 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 | 186 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 281 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 195 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 189 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 214 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 190 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 222 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 196 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 224 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 241 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 236 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 203 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 402 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 494 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 221 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 260 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 207 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 203 ms | 262144 KB | Execution killed with signal 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 221 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 233 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 574 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 236 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 395 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 230 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 207 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 234 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 416 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 694 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 572 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 287 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 202 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 244 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 481 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 228 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 438 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 433 ms | 262144 KB | Execution killed with signal 9 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 231 ms | 262144 KB | Execution killed with signal 9 |
2 | Runtime error | 242 ms | 262144 KB | Execution killed with signal 9 |
3 | Runtime error | 563 ms | 262144 KB | Execution killed with signal 9 |
4 | Runtime error | 171 ms | 262144 KB | Execution killed with signal 9 |
5 | Runtime error | 238 ms | 262144 KB | Execution killed with signal 9 |
6 | Runtime error | 197 ms | 262144 KB | Execution killed with signal 9 |
7 | Runtime error | 356 ms | 262144 KB | Execution killed with signal 9 |
8 | Runtime error | 200 ms | 262144 KB | Execution killed with signal 9 |
9 | Runtime error | 222 ms | 262144 KB | Execution killed with signal 9 |
10 | Runtime error | 190 ms | 262144 KB | Execution killed with signal 9 |
11 | Runtime error | 140 ms | 262144 KB | Execution killed with signal 9 |
12 | Runtime error | 208 ms | 262144 KB | Execution killed with signal 9 |
13 | Runtime error | 498 ms | 262144 KB | Execution killed with signal 9 |
14 | Runtime error | 276 ms | 262144 KB | Execution killed with signal 9 |
15 | Runtime error | 211 ms | 262144 KB | Execution killed with signal 9 |
16 | Runtime error | 238 ms | 262144 KB | Execution killed with signal 9 |
17 | Runtime error | 186 ms | 262144 KB | Execution killed with signal 9 |
18 | Runtime error | 266 ms | 262144 KB | Execution killed with signal 9 |
19 | Runtime error | 147 ms | 262144 KB | Execution killed with signal 9 |
20 | Runtime error | 674 ms | 262144 KB | Execution killed with signal 9 |
21 | Runtime error | 439 ms | 262144 KB | Execution killed with signal 9 |
22 | Runtime error | 274 ms | 262144 KB | Execution killed with signal 9 |
23 | Runtime error | 222 ms | 262144 KB | Execution killed with signal 9 |
24 | Runtime error | 132 ms | 262144 KB | Execution killed with signal 9 |
25 | Runtime error | 186 ms | 262144 KB | Execution killed with signal 9 |
26 | Runtime error | 166 ms | 262144 KB | Execution killed with signal 9 |
27 | Runtime error | 689 ms | 262144 KB | Execution killed with signal 9 |
28 | Runtime error | 258 ms | 262144 KB | Execution killed with signal 9 |
29 | Runtime error | 243 ms | 262144 KB | Execution killed with signal 9 |
30 | Runtime error | 233 ms | 262144 KB | Execution killed with signal 9 |
31 | Runtime error | 154 ms | 262144 KB | Execution killed with signal 9 |
32 | Runtime error | 133 ms | 262144 KB | Execution killed with signal 9 |
33 | Runtime error | 135 ms | 262144 KB | Execution killed with signal 9 |
34 | Runtime error | 346 ms | 262144 KB | Execution killed with signal 9 |
35 | Runtime error | 260 ms | 262144 KB | Execution killed with signal 9 |
36 | Runtime error | 267 ms | 262144 KB | Execution killed with signal 9 |
37 | Runtime error | 227 ms | 262144 KB | Execution killed with signal 9 |
38 | Runtime error | 219 ms | 262144 KB | Execution killed with signal 9 |
39 | Runtime error | 131 ms | 262144 KB | Execution killed with signal 9 |
40 | Runtime error | 199 ms | 262144 KB | Execution killed with signal 9 |
41 | Runtime error | 428 ms | 262144 KB | Execution killed with signal 9 |
42 | Runtime error | 563 ms | 262144 KB | Execution killed with signal 9 |