poj2823 题目链接 长度为N的数组,求宽度k的滑动窗口在数组上滑动时窗口内的最大值或最小值 如果用单调队列做,求最小值时,队列应该严格递增的.所以插入时,队尾大于等于插入值的元素都应被舍弃,因为插入元素不仅小而且新,没有必要保留队尾这些又大又旧的元素. /*选C++交是5k多毫秒,但是G++就会超时.*/#include <cstdio> #include <cstring> ; int data[N]; int o1[N],o2[N]; int q[N]; int n,k;…
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 32099 Accepted: 9526 Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left o…
POJ2823 Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 38342 Accepted: 11359 Case Time Limit: 5000MS Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the ve…