![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
瞌睡的鱼
这个作者很懒,什么都没留下…
展开
-
洛谷P1638逛画展(双端队列)
#include<bits/stdc++.h>using namespace std;const int N=1e6+10;const int M=2e3+10;struct node1{//结构体存储n幅画对应的画家以及画的下标 int num,idx;}a[N];int n,m,cnt,cnt0;int vis[M];//用于判断是否已经看过这个画家的画以及看的次数 struct node2{//用于记录可行方案的长度,起点、终点坐标 int len,s,t;/..原创 2021-04-13 18:49:26 · 213 阅读 · 0 评论 -
CF B题BoxFitting
#include<bits/stdc++.h>using namespace std;inline int read(){ int x=0,t=1;char ch=getchar(); while((ch<'0'||ch>'9')&&ch!='-') ch=getchar(); if(ch=='-'){t=-1;ch=getchar();} while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=ge.原创 2021-04-13 15:09:07 · 163 阅读 · 0 评论 -
洛谷P1886滑动窗口(单调队列)
#include<bits/stdc++.h>using namespace std;const int N=1e6+10;# define INF 0x3f3f3f3fint maxn=-INF,minn=INF;int n,k;struct node{//用结构体存储数值及其对应的下标 long long v;//记录元素的值 int idx;//记录下标,用于判断该元素是否还在窗口范围内 }a[N]; long long lar[N],sma[N];int ma.原创 2021-04-12 16:17:51 · 138 阅读 · 0 评论 -
洛谷P5788单调栈模板
#include<bits/stdc++.h>using namespace std;const int N=3e6+10;int ans[N];struct node{ int v,index;}a[N]; int n,cnt=0;inline int read(){ int x=0,t=1;char ch=getchar(); while((ch<'0'||ch>'9')&&ch!='-') ch=getchar(); if(ch=='-.原创 2021-04-11 00:17:26 · 146 阅读 · 0 评论 -
洛谷P1901发射站(单调栈)
#include<bits/stdc++.h>using namespace std;const int N=1e6+10;int n;long long ans,cnt;struct node{ int v; long long h;}fsz[N];long long a[N],b[N];//分别存储发射站从左侧和右侧接收的能量 inline int read(){ int x=0,t=1;char ch=getchar(); while((ch<'0'||c.原创 2021-04-10 23:54:27 · 219 阅读 · 0 评论