# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
155780 | 2019-09-30T14:08:29 Z | karma | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 429 ms | 79208 KB |
#include<bits/stdc++.h> #define Task "test" #define pb emplace_back using namespace std; const int N = int(1e7) + 1; const int inf = int(1e9); int nxt[N], f[N], m, Q, n, x; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> m >> Q; while(m --) { cin >> x; for(int i = x; i <= N; i += x) nxt[i - 1] = max(nxt[i - 1], x - 1); } for(int i = N - 1; i >= 1; --i) nxt[i] = max(nxt[i], nxt[i + 1] - 1); for(int i = 1; i < N; ++i) { if(nxt[i]) f[i] = f[i - nxt[i]] + 1; else f[i] = inf; } while(Q --) { cin >> x; if(f[x] >= inf) cout << "oo\n"; else cout << f[x] << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 134 ms | 78584 KB | Output is correct |
2 | Correct | 154 ms | 78560 KB | Output is correct |
3 | Correct | 164 ms | 78560 KB | Output is correct |
4 | Correct | 137 ms | 78564 KB | Output is correct |
5 | Correct | 145 ms | 78560 KB | Output is correct |
6 | Correct | 134 ms | 78580 KB | Output is correct |
7 | Correct | 144 ms | 78584 KB | Output is correct |
8 | Correct | 149 ms | 78536 KB | Output is correct |
9 | Correct | 171 ms | 78684 KB | Output is correct |
10 | Correct | 202 ms | 78564 KB | Output is correct |
11 | Correct | 177 ms | 78580 KB | Output is correct |
12 | Correct | 132 ms | 78584 KB | Output is correct |
13 | Correct | 292 ms | 78584 KB | Output is correct |
14 | Correct | 283 ms | 78712 KB | Output is correct |
15 | Correct | 193 ms | 78584 KB | Output is correct |
16 | Correct | 154 ms | 78584 KB | Output is correct |
17 | Correct | 164 ms | 78564 KB | Output is correct |
18 | Correct | 133 ms | 78584 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 157 ms | 78576 KB | Output is correct |
2 | Correct | 170 ms | 78532 KB | Output is correct |
3 | Correct | 340 ms | 78668 KB | Output is correct |
4 | Correct | 169 ms | 78580 KB | Output is correct |
5 | Correct | 252 ms | 78584 KB | Output is correct |
6 | Correct | 155 ms | 78580 KB | Output is correct |
7 | Correct | 150 ms | 78584 KB | Output is correct |
8 | Correct | 169 ms | 78560 KB | Output is correct |
9 | Correct | 288 ms | 78584 KB | Output is correct |
10 | Correct | 408 ms | 78584 KB | Output is correct |
11 | Incorrect | 328 ms | 78640 KB | Output isn't correct |
12 | Correct | 216 ms | 78584 KB | Output is correct |
13 | Correct | 141 ms | 78616 KB | Output is correct |
14 | Correct | 172 ms | 78584 KB | Output is correct |
15 | Correct | 288 ms | 78536 KB | Output is correct |
16 | Correct | 171 ms | 78696 KB | Output is correct |
17 | Correct | 291 ms | 78568 KB | Output is correct |
18 | Correct | 294 ms | 78692 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 78796 KB | Output is correct |
2 | Correct | 346 ms | 78712 KB | Output is correct |
3 | Correct | 354 ms | 78824 KB | Output is correct |
4 | Incorrect | 240 ms | 78840 KB | Output isn't correct |
5 | Incorrect | 203 ms | 78840 KB | Output isn't correct |
6 | Correct | 324 ms | 78816 KB | Output is correct |
7 | Correct | 281 ms | 78844 KB | Output is correct |
8 | Correct | 315 ms | 78712 KB | Output is correct |
9 | Correct | 298 ms | 78728 KB | Output is correct |
10 | Correct | 245 ms | 78584 KB | Output is correct |
11 | Incorrect | 237 ms | 78708 KB | Output isn't correct |
12 | Correct | 279 ms | 78712 KB | Output is correct |
13 | Correct | 345 ms | 78968 KB | Output is correct |
14 | Correct | 221 ms | 79204 KB | Output is correct |
15 | Incorrect | 287 ms | 78716 KB | Output isn't correct |
16 | Correct | 320 ms | 78712 KB | Output is correct |
17 | Correct | 273 ms | 78712 KB | Output is correct |
18 | Correct | 367 ms | 78712 KB | Output is correct |
19 | Incorrect | 182 ms | 78712 KB | Output isn't correct |
20 | Correct | 356 ms | 78832 KB | Output is correct |
21 | Incorrect | 245 ms | 79208 KB | Output isn't correct |
22 | Correct | 429 ms | 78820 KB | Output is correct |
23 | Correct | 205 ms | 78988 KB | Output is correct |
24 | Correct | 180 ms | 78848 KB | Output is correct |
25 | Incorrect | 262 ms | 79096 KB | Output isn't correct |
26 | Incorrect | 247 ms | 78916 KB | Output isn't correct |
27 | Correct | 427 ms | 78692 KB | Output is correct |
28 | Incorrect | 205 ms | 78920 KB | Output isn't correct |
29 | Correct | 353 ms | 78864 KB | Output is correct |
30 | Correct | 383 ms | 78840 KB | Output is correct |
31 | Correct | 196 ms | 78940 KB | Output is correct |
32 | Incorrect | 209 ms | 78896 KB | Output isn't correct |
33 | Incorrect | 160 ms | 78840 KB | Output isn't correct |
34 | Correct | 281 ms | 78804 KB | Output is correct |
35 | Incorrect | 177 ms | 78968 KB | Output isn't correct |
36 | Correct | 362 ms | 78872 KB | Output is correct |
37 | Incorrect | 205 ms | 78840 KB | Output isn't correct |
38 | Correct | 304 ms | 78840 KB | Output is correct |
39 | Incorrect | 185 ms | 78840 KB | Output isn't correct |
40 | Correct | 279 ms | 79096 KB | Output is correct |
41 | Correct | 291 ms | 78716 KB | Output is correct |
42 | Incorrect | 390 ms | 79068 KB | Output isn't correct |