peppaking8 @ 2019-05-17 19:48:12
#include<bits/stdc++.h>
using namespace std;
struct node{
int id,num;
}a[200005];
deque<node>q;
int n,m;
int main(){
ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>a[i].num;
a[i].id=i;
}
cout<<0<<endl;
for(int i=0;i<n-1;i++){
while(!q.empty()&&q.back().num>a[i].num){
q.pop_back();
}
q.push_back(a[i]);
while(q.front().id+m<=i) q.pop_front();
cout<<q.front().num<<endl;
}
return 0;
}
by 樱初音斗橡皮 @ 2019-05-17 19:51:24
@用户未知 数组开小了一个0
by peppaking8 @ 2019-05-17 19:54:04
@樱初音斗橡皮
但还是
by 142857cs @ 2019-05-17 20:01:38
@用户未知 deque好像很慢?
by 142857cs @ 2019-05-17 20:03:06
突然开始同情lxl
by peppaking8 @ 2019-05-17 20:14:52
唉换了数组过了