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…
最近BZOJ炸了,而我的博客上又更新了一些基本知识,所以这里刷一些裸题,用以丰富知识性博客 POJ2823 滑动的窗口 这是一道经典的单调队题,我记得我刚学的时候就是用这道题作为单调队列的例题,算一道比较基本的题目 先贴题目 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 of the arr…
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: 41844 Accepted: 12384 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…