# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
618819 | HappyPacMan | OGLEDALA (COI15_ogledala) | C++14 | 2563 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |