# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
155868 | 2019-10-01T10:01:35 Z | HellAngel | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 676 ms | 169128 KB |
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 7; const int maxans = 1e7 + 696969; int m, q, p[maxn], last[maxans], dp[maxans]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout); cin >> m >> q; for(int i = 1; i <= m; i++) { cin >> p[i]; for(int j = p[i] - 1; j < maxans; j += p[i]) { last[j] = p[i] - 1; } last[maxans - 1] = maxans % p[i]; } for(int i = maxans - 2; i >= 0; i--) { last[i] = max(last[i], last[i + 1] - 1); } for(int i = 1; i < maxans; i++) { if(last[i] != 0) dp[i] = dp[i - last[i]] + 1; } for(int i = 1; i <= q; i++) { int x; cin >> x; if(dp[x] == 0) cout << "oo" << '\n'; else cout << dp[x] << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 192 ms | 167800 KB | Output isn't correct |
2 | Correct | 210 ms | 167928 KB | Output is correct |
3 | Correct | 194 ms | 167776 KB | Output is correct |
4 | Correct | 177 ms | 167828 KB | Output is correct |
5 | Correct | 203 ms | 167876 KB | Output is correct |
6 | Incorrect | 196 ms | 167780 KB | Output isn't correct |
7 | Correct | 195 ms | 167800 KB | Output is correct |
8 | Correct | 208 ms | 167832 KB | Output is correct |
9 | Correct | 238 ms | 167832 KB | Output is correct |
10 | Correct | 275 ms | 167900 KB | Output is correct |
11 | Correct | 303 ms | 167928 KB | Output is correct |
12 | Correct | 203 ms | 167804 KB | Output is correct |
13 | Correct | 504 ms | 167928 KB | Output is correct |
14 | Correct | 514 ms | 167900 KB | Output is correct |
15 | Correct | 238 ms | 168036 KB | Output is correct |
16 | Correct | 248 ms | 167800 KB | Output is correct |
17 | Correct | 238 ms | 168052 KB | Output is correct |
18 | Correct | 179 ms | 167864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 256 ms | 167928 KB | Output is correct |
2 | Correct | 268 ms | 168712 KB | Output is correct |
3 | Correct | 521 ms | 168440 KB | Output is correct |
4 | Correct | 265 ms | 167932 KB | Output is correct |
5 | Correct | 364 ms | 168440 KB | Output is correct |
6 | Correct | 205 ms | 167800 KB | Output is correct |
7 | Correct | 225 ms | 168068 KB | Output is correct |
8 | Correct | 270 ms | 167800 KB | Output is correct |
9 | Correct | 405 ms | 168600 KB | Output is correct |
10 | Correct | 510 ms | 168492 KB | Output is correct |
11 | Correct | 490 ms | 168492 KB | Output is correct |
12 | Correct | 292 ms | 167800 KB | Output is correct |
13 | Correct | 183 ms | 167800 KB | Output is correct |
14 | Correct | 232 ms | 167900 KB | Output is correct |
15 | Correct | 413 ms | 168184 KB | Output is correct |
16 | Correct | 224 ms | 168696 KB | Output is correct |
17 | Correct | 524 ms | 167928 KB | Output is correct |
18 | Correct | 437 ms | 168788 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 484 ms | 168744 KB | Output is correct |
2 | Correct | 569 ms | 168544 KB | Output is correct |
3 | Correct | 619 ms | 168564 KB | Output is correct |
4 | Correct | 387 ms | 168300 KB | Output is correct |
5 | Correct | 284 ms | 168948 KB | Output is correct |
6 | Correct | 515 ms | 168316 KB | Output is correct |
7 | Correct | 452 ms | 168828 KB | Output is correct |
8 | Correct | 535 ms | 168436 KB | Output is correct |
9 | Correct | 463 ms | 168508 KB | Output is correct |
10 | Correct | 385 ms | 167960 KB | Output is correct |
11 | Correct | 328 ms | 168028 KB | Output is correct |
12 | Correct | 398 ms | 168056 KB | Output is correct |
13 | Correct | 504 ms | 168484 KB | Output is correct |
14 | Correct | 320 ms | 168440 KB | Output is correct |
15 | Correct | 423 ms | 168184 KB | Output is correct |
16 | Correct | 487 ms | 168104 KB | Output is correct |
17 | Correct | 458 ms | 168248 KB | Output is correct |
18 | Correct | 533 ms | 168388 KB | Output is correct |
19 | Correct | 198 ms | 168056 KB | Output is correct |
20 | Correct | 531 ms | 168484 KB | Output is correct |
21 | Correct | 354 ms | 168568 KB | Output is correct |
22 | Correct | 628 ms | 168976 KB | Output is correct |
23 | Correct | 268 ms | 168440 KB | Output is correct |
24 | Correct | 256 ms | 168184 KB | Output is correct |
25 | Correct | 361 ms | 168440 KB | Output is correct |
26 | Correct | 330 ms | 168312 KB | Output is correct |
27 | Correct | 676 ms | 168976 KB | Output is correct |
28 | Correct | 226 ms | 168248 KB | Output is correct |
29 | Correct | 548 ms | 169128 KB | Output is correct |
30 | Correct | 489 ms | 168756 KB | Output is correct |
31 | Correct | 247 ms | 168184 KB | Output is correct |
32 | Correct | 275 ms | 168312 KB | Output is correct |
33 | Correct | 343 ms | 168316 KB | Output is correct |
34 | Correct | 441 ms | 168996 KB | Output is correct |
35 | Correct | 255 ms | 168244 KB | Output is correct |
36 | Correct | 615 ms | 168876 KB | Output is correct |
37 | Correct | 311 ms | 168952 KB | Output is correct |
38 | Correct | 524 ms | 168312 KB | Output is correct |
39 | Correct | 240 ms | 168276 KB | Output is correct |
40 | Correct | 386 ms | 168312 KB | Output is correct |
41 | Correct | 339 ms | 168824 KB | Output is correct |
42 | Correct | 509 ms | 168400 KB | Output is correct |