下载了第一个数据点,输出一模一样。为什么 WA ?QwQ
#include<bits/stdc++.h>
using namespace std;
struct cxk{
int zhi,wei;
bool operator < (const cxk&b) const
{
return zhi < b.zhi;
}
};
int n,k;
priority_queue<cxk> q;
cxk op,ba;
int a[1000005];
int main(){
cin>>n>>k;
for(int i=1,x;i<=k;i++){
cin>>x;
a[i]=x;
op.zhi=x;
op.wei=i;
q.push(op);
}
ba=q.top();
cout<<ba.zhi<<endl;
for(int i=1,l=1;i<=n-k;i++,l++){
int y;
ba=q.top();
op.wei=k+i;
cin>>y;
op.zhi=y;
q.push(op);
if(ba.wei<i+1||ba.wei>i+k) q.pop();
ba=q.top();
cout<<ba.zhi<<endl;
}
return 0;
}