Submission #846345

#TimeUsernameProblemLanguageResultExecution timeMemory
846345vjudge1OGLEDALA (COI15_ogledala)C++17
41 / 100
256 ms15288 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define tol(bi) (1LL<<((int)(bi))) int32_t main(){ int m,n,q; cin>>m>>n>>q; priority_queue<array<int,2>> pq; int lel = 0; vector<int> arr(300000); for (int i = 0; i < n; i++){ int x;cin>>x; arr[i]=x; if (lel!=x-1){ pq.push({x-1-(lel+1)+1,-(lel+1)}); } lel=x; } if (lel!=m){ pq.push({m-(lel+1)+1,-(lel+1)}); } for (int i = 0; i < 300000-n; i++){ int l = -pq.top()[1]; int r = l+pq.top()[0]-1; pq.pop(); arr[i+n]=l+(r-l)/2; if (arr[i+n]!=l){ pq.push({arr[i+n]-l,-l}); } if (arr[i+n]!=r){ pq.push({r-arr[i+n],-arr[i+n]-1}); } } while (q--){ int x;cin>>x; cout<<arr[x-1]<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...