# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
618819 | 2022-08-02T07:43:29 Z | HappyPacMan | OGLEDALA (COI15_ogledala) | C++14 | 2563 ms | 524288 KB |
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int M,N,Q; cin >> M >> N >> Q; vector<int> vec; vec.push_back(0); for(int i=0;i<N;i++){ int Ai; cin >> Ai; vec.push_back(Ai); } vec.push_back(M+1); priority_queue<pair<int,int> > pq; for(int i=1;i<vec.size();i++){ pq.emplace(vec[i]-vec[i-1],-vec[i-1]); } int curr = N+1; while(Q--){ int Bi; cin >> Bi; if(Bi <= N){ cout << vec[Bi] << "\n"; }else{ while(curr < Bi){ auto [u,v] = pq.top(); pq.pop(); int lw = u/2; int hg = (u+1)/2; pq.emplace(lw,v); pq.emplace(hg,v-lw); curr++; } auto [u,v] = pq.top(); cout << -v+u/2 << "\n"; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 25 ms | 2888 KB | Output is correct |
4 | Correct | 25 ms | 2916 KB | Output is correct |
5 | Correct | 56 ms | 9976 KB | Output is correct |
6 | Correct | 60 ms | 9980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 8616 KB | Output is correct |
2 | Correct | 40 ms | 8640 KB | Output is correct |
3 | Correct | 66 ms | 10472 KB | Output is correct |
4 | Correct | 61 ms | 10584 KB | Output is correct |
5 | Correct | 65 ms | 10748 KB | Output is correct |
6 | Correct | 72 ms | 10676 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2563 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |