# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1069167 | 2024-08-21T16:44:56 Z | ortsac | Brunhilda’s Birthday (BOI13_brunhilda) | C++17 | 12 ms | 4160 KB |
#pragma GCC optimization("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<long long, long long> #define fr first #define se second int inf = 0x3f3f3f3f3f3f3f3f; const int MAXN = 1e4; int dp[MAXN + 10]; priority_queue<pii> pq; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; for (int i = 0; i < n; i++) { int a; cin >> a; pq.push({0, a}); } for (int i = 1; i <= MAXN; i++) { dp[i] = inf; while ((pq.top().se - pq.top().fr) <= i) { auto u = pq.top(); pq.pop(); pq.push({u.fr - u.se, u.se}); } dp[i] = min(dp[i], dp[-pq.top().fr] + 1); } while (q--) { int x; cin >> x; if (dp[x] == inf) cout << "oo\n"; else cout << dp[x] << "\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1248 KB | Execution killed with signal 11 |
2 | Runtime error | 12 ms | 3768 KB | Execution killed with signal 11 |
3 | Runtime error | 9 ms | 3028 KB | Execution killed with signal 11 |
4 | Runtime error | 2 ms | 860 KB | Execution killed with signal 11 |
5 | Runtime error | 7 ms | 2516 KB | Execution killed with signal 11 |
6 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
7 | Runtime error | 2 ms | 1248 KB | Execution killed with signal 11 |
8 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
9 | Runtime error | 9 ms | 3260 KB | Execution killed with signal 11 |
10 | Runtime error | 8 ms | 3028 KB | Execution killed with signal 11 |
11 | Runtime error | 5 ms | 2260 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
13 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
14 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
15 | Runtime error | 5 ms | 2260 KB | Execution killed with signal 11 |
16 | Runtime error | 10 ms | 3796 KB | Execution killed with signal 11 |
17 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
18 | Runtime error | 12 ms | 4048 KB | Execution killed with signal 11 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
2 | Runtime error | 6 ms | 2520 KB | Execution killed with signal 11 |
3 | Runtime error | 6 ms | 2516 KB | Execution killed with signal 11 |
4 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
5 | Runtime error | 12 ms | 4048 KB | Execution killed with signal 11 |
6 | Runtime error | 2 ms | 1116 KB | Execution killed with signal 11 |
7 | Runtime error | 12 ms | 4084 KB | Execution killed with signal 11 |
8 | Runtime error | 6 ms | 2520 KB | Execution killed with signal 11 |
9 | Runtime error | 6 ms | 2520 KB | Execution killed with signal 11 |
10 | Runtime error | 1 ms | 1116 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 1116 KB | Execution killed with signal 11 |
12 | Runtime error | 2 ms | 1116 KB | Execution killed with signal 11 |
13 | Runtime error | 4 ms | 1752 KB | Execution killed with signal 11 |
14 | Runtime error | 2 ms | 604 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 1000 KB | Execution killed with signal 11 |
16 | Runtime error | 2 ms | 1116 KB | Execution killed with signal 11 |
17 | Runtime error | 6 ms | 2264 KB | Execution killed with signal 11 |
18 | Runtime error | 6 ms | 2520 KB | Execution killed with signal 11 |
19 | Runtime error | 2 ms | 1116 KB | Execution killed with signal 11 |
20 | Runtime error | 6 ms | 2520 KB | Execution killed with signal 11 |
21 | Runtime error | 1 ms | 528 KB | Execution killed with signal 11 |
22 | Runtime error | 11 ms | 4072 KB | Execution killed with signal 11 |
23 | Runtime error | 4 ms | 1756 KB | Execution killed with signal 11 |
24 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
25 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
26 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
27 | Runtime error | 12 ms | 4104 KB | Execution killed with signal 11 |
28 | Runtime error | 1 ms | 600 KB | Execution killed with signal 11 |
29 | Runtime error | 11 ms | 4052 KB | Execution killed with signal 11 |
30 | Runtime error | 9 ms | 3160 KB | Execution killed with signal 11 |
31 | Runtime error | 1 ms | 1112 KB | Execution killed with signal 11 |
32 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
33 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
34 | Runtime error | 12 ms | 4160 KB | Execution killed with signal 11 |
35 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
36 | Runtime error | 10 ms | 3812 KB | Execution killed with signal 11 |
37 | Runtime error | 12 ms | 4096 KB | Execution killed with signal 11 |
38 | Runtime error | 2 ms | 1116 KB | Execution killed with signal 11 |
39 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |
40 | Runtime error | 2 ms | 1248 KB | Execution killed with signal 11 |
41 | Runtime error | 11 ms | 4052 KB | Execution killed with signal 11 |
42 | Runtime error | 1 ms | 860 KB | Execution killed with signal 11 |