变长滑动窗口
class Solution {
public:
vector<int> maxInWindows(vector<int>& nums, int k) {
int len = nums.size();
int* q = new int[len*2];
int head = 0, tail = 0;
vector<int> ans;
for(int i = 0; i < len; i ++){
while(head < tail && q[head] < i - k + 1)head ++;
while(head < tail && nums[i] >= nums[q[tail-1]])tail --;
q[tail++] = i;
if(i - k + 1 >= 0)ans.push_back(nums[q[head]]);
}
delete[] q;
return ans;
}
};