#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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2904 KB |
Output is correct |
2 |
Correct |
3 ms |
2808 KB |
Output is correct |
3 |
Correct |
136 ms |
3792 KB |
Output is correct |
4 |
Correct |
121 ms |
3792 KB |
Output is correct |
5 |
Correct |
184 ms |
5312 KB |
Output is correct |
6 |
Correct |
185 ms |
5312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
12532 KB |
Output is correct |
2 |
Correct |
46 ms |
12824 KB |
Output is correct |
3 |
Correct |
256 ms |
11704 KB |
Output is correct |
4 |
Correct |
198 ms |
11452 KB |
Output is correct |
5 |
Correct |
220 ms |
12732 KB |
Output is correct |
6 |
Correct |
213 ms |
11964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
67 ms |
15288 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |