Submission #846361

#TimeUsernameProblemLanguageResultExecution timeMemory
846361vjudge1OGLEDALA (COI15_ogledala)C++17
41 / 100
215 ms17080 KiB
#include <bits/stdc++.h> #define min(x,y) (x>=y?y:x) #define max(x,y) ((x)>=(y)?(x):(y)) #define xc3(x) (x*(x-1)*(x-2)/6) #define xc2(x) (x*(x-1)/2) #define GF G[node][i].first #define tll tuple<ll,ll,ll> #define pq1 (get<0>(pq.top())) #define pq2 (get<1>(pq.top())) #define pq3 (get<2>(pq.top())) #define K ((A-1)/2) using namespace std; #define ll long long #define ull unsigned long long int main() { ll N,M,Q;cin>>M>>N>>Q; //priority_queue<tll,vector<tll>,greater<tll>>pq; priority_queue<tll>pq; vector<ll> AR(300005,-1); ll i=1; for(ll j=0;j<N;j++){ ll bq;cin>>bq; AR[j]=bq; pq.push(make_tuple(bq-i,M-i,M-(bq-1))); i=bq+1; } pq.push(make_tuple(M-i+1,M-i,0)); vector<int> qar(Q);for(int &x:qar)cin>>x; // while(!pq.empty()){cout<<pq1<<" "<<pq2<<" "<<pq3<<endl;pq.pop();} PRINT THE QUEUE for(int j=N;j<qar[qar.size()-1];j++){ ll A=pq1,B=M-pq2,C=M-pq3; pq.pop(); AR[j]=B+K; tuple<ll,ll,ll> tpl = make_tuple(K,M-B,M-(B+K-1)); pq.push(tpl); tpl = make_tuple(A/2,M-(B+K+1),M-C); pq.push(tpl); } for(auto &j:qar){ cout << AR[j-1]<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...