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;…
Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 53086 Accepted: 15227 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 of the array to…
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…
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 53676 Accepted: 15399 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…
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…
题意:给你长度位n的数组,问每个长度为m的段的最值: 解题思路:这道题是单调队列的入门题: #include<iostream> #include<algorithm> #include<queue> #include<cstdio> #define maxn 1000100 using namespace std; struct node { int val; int pos; }a[maxn]; int que[maxn]; int mn[maxn];…
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 50738 Accepted: 14590 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…
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 62930 Accepted: 17963 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…