# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130695 | 2019-07-15T22:41:27 Z | MohamedAhmed04 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 114 ms | 8048 KB |
#include <bits/stdc++.h> using namespace std ; const int MAX = 1e7 + 5 ; const int OO = 1e9 ; int dp[MAX] ; int main() { int n , q ; scanf("%d %d" , &n , &q) ; int arr[n] ; for(int i = 0 ; i < n ; ++i) scanf("%d" , &arr[i]) ; priority_queue< pair<int , int> , vector< pair<int , int> > , greater< pair<int , int> > >pq ; multiset<int>s ; for(int i = 0 ; i < n ; ++i) { pq.push({arr[i] , arr[i]}) ; s.insert(0) ; } dp[0] = 0 ; const int cons = 1e7 ; for(int i = 1 ; i <= 20000 ; ++i) { while(pq.size() > 0) { pair<int , int>pp = pq.top() ; if(pp.first == i) { pq.pop() ; pq.push({pp.first + pp.second , pp.second}) ; s.erase(s.find(pp.first - pp.second)) ; s.insert(pp.first) ; } else break ; } int x = *s.begin() ; if(x == i) dp[i] = OO ; else dp[i] = dp[x] + 1 ; } while(q--) { int x ; scanf("%d" , &x) ; if(dp[x] >= OO) cout<<"oo\n" ; else cout<<dp[x]<<"\n"; } return 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 4 ms | 380 KB | Output is correct |
9 | Correct | 6 ms | 380 KB | Output is correct |
10 | Correct | 8 ms | 376 KB | Output is correct |
11 | Correct | 6 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 16 ms | 504 KB | Output is correct |
14 | Correct | 19 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 6 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 504 KB | Output is correct |
18 | Correct | 5 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 1224 KB | Output isn't correct |
2 | Incorrect | 43 ms | 6516 KB | Output isn't correct |
3 | Incorrect | 60 ms | 5232 KB | Output isn't correct |
4 | Incorrect | 5 ms | 604 KB | Output isn't correct |
5 | Incorrect | 36 ms | 3824 KB | Output isn't correct |
6 | Incorrect | 5 ms | 500 KB | Output isn't correct |
7 | Incorrect | 7 ms | 1272 KB | Output isn't correct |
8 | Incorrect | 5 ms | 504 KB | Output isn't correct |
9 | Incorrect | 48 ms | 5232 KB | Output isn't correct |
10 | Incorrect | 60 ms | 5204 KB | Output isn't correct |
11 | Incorrect | 43 ms | 3052 KB | Output isn't correct |
12 | Incorrect | 9 ms | 504 KB | Output isn't correct |
13 | Incorrect | 5 ms | 632 KB | Output isn't correct |
14 | Incorrect | 6 ms | 632 KB | Output isn't correct |
15 | Incorrect | 40 ms | 3184 KB | Output isn't correct |
16 | Incorrect | 43 ms | 6508 KB | Output isn't correct |
17 | Incorrect | 17 ms | 632 KB | Output isn't correct |
18 | Incorrect | 63 ms | 7148 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 61 ms | 4076 KB | Output isn't correct |
2 | Incorrect | 69 ms | 4088 KB | Output isn't correct |
3 | Incorrect | 71 ms | 4252 KB | Output isn't correct |
4 | Incorrect | 51 ms | 1528 KB | Output isn't correct |
5 | Incorrect | 86 ms | 7876 KB | Output isn't correct |
6 | Incorrect | 59 ms | 1912 KB | Output isn't correct |
7 | Incorrect | 68 ms | 7532 KB | Output isn't correct |
8 | Incorrect | 63 ms | 4080 KB | Output isn't correct |
9 | Incorrect | 62 ms | 4080 KB | Output isn't correct |
10 | Incorrect | 22 ms | 1016 KB | Output isn't correct |
11 | Incorrect | 26 ms | 1016 KB | Output isn't correct |
12 | Incorrect | 33 ms | 1144 KB | Output isn't correct |
13 | Incorrect | 58 ms | 3244 KB | Output isn't correct |
14 | Incorrect | 32 ms | 1296 KB | Output isn't correct |
15 | Incorrect | 36 ms | 1080 KB | Output isn't correct |
16 | Incorrect | 37 ms | 1144 KB | Output isn't correct |
17 | Incorrect | 46 ms | 3568 KB | Output isn't correct |
18 | Incorrect | 68 ms | 4208 KB | Output isn't correct |
19 | Incorrect | 24 ms | 1016 KB | Output isn't correct |
20 | Incorrect | 66 ms | 4176 KB | Output isn't correct |
21 | Incorrect | 36 ms | 1444 KB | Output isn't correct |
22 | Incorrect | 103 ms | 7912 KB | Output isn't correct |
23 | Incorrect | 45 ms | 3440 KB | Output isn't correct |
24 | Incorrect | 43 ms | 1604 KB | Output isn't correct |
25 | Incorrect | 49 ms | 1612 KB | Output isn't correct |
26 | Incorrect | 47 ms | 1528 KB | Output isn't correct |
27 | Incorrect | 89 ms | 7528 KB | Output isn't correct |
28 | Incorrect | 29 ms | 1400 KB | Output isn't correct |
29 | Incorrect | 90 ms | 8048 KB | Output isn't correct |
30 | Incorrect | 74 ms | 5996 KB | Output isn't correct |
31 | Incorrect | 42 ms | 1724 KB | Output isn't correct |
32 | Incorrect | 44 ms | 1656 KB | Output isn't correct |
33 | Incorrect | 41 ms | 1400 KB | Output isn't correct |
34 | Incorrect | 68 ms | 7528 KB | Output isn't correct |
35 | Incorrect | 31 ms | 1528 KB | Output isn't correct |
36 | Incorrect | 114 ms | 7400 KB | Output isn't correct |
37 | Incorrect | 73 ms | 7904 KB | Output isn't correct |
38 | Incorrect | 55 ms | 1912 KB | Output isn't correct |
39 | Incorrect | 44 ms | 1528 KB | Output isn't correct |
40 | Incorrect | 54 ms | 1960 KB | Output isn't correct |
41 | Incorrect | 73 ms | 7560 KB | Output isn't correct |
42 | Incorrect | 43 ms | 1528 KB | Output isn't correct |