乙轩 @ 2023-12-30 20:55:47
#include <bits/stdc++.h>
using namespace std;
int n,m;
int a[2000007];
deque <int> q;
int main()
{
cin >> n >> m;
for (int i=1;i <= n;i++){
cin >> a[i];
}
for (int i=1;i <= n;i++){
while (!q.empty() && i-m > q.front())
{
q.pop_front();
}
if (q.empty()) cout << 0 << endl;
else cout << a[q.front()] << endl;
while(!q.empty() && a[i] <= a[q.back()]){
q.pop_back();
}
q.push_back(i);
}
return 0;
}
by 乙轩 @ 2023-12-30 21:00:53
AC了谢谢
by kkkk889412 @ 2024-02-02 14:27:52
@乙轩 @乙轩 咋ac的,改的哪里啊,我写的跟你这个一模一样
by 乙轩 @ 2024-02-02 20:55:05
@kkkk889412 要用scanf/printf()