02 2020 档案

摘要:``` #include using namespace std ; const int N=10000000; int a[N],idx,son[N][2]; //把每个数插入到trie树中 void insert(int x) { //从头开始插入 int p=0; for(int i=30;i>=0;i--) { //取出当前位 int u=x>>i&1; //如果之前不存在的话 if(!s 阅读全文
posted @ 2020-02-29 21:00 晴屿
摘要:``` #include using namespace std ; const int N=10000000; int a[N],idx,son[N][2]; //把每个数插入到trie树中 void insert(int x) { //从头开始插入 int p=0; for(int i=30;i>=0;i--) { //取出当前位 int u=x>>i&1; //如果之前不存在的话 if(!s 阅读全文
posted @ 2020-02-29 20:38 晴屿
摘要:参考文章:https://blog.csdn.net/u013686535/article/details/52197912 阅读全文
posted @ 2020-02-29 20:14 晴屿
摘要:```#include#includeusing namespace std ;const int N=1e6+10;int n,m;int ne[N];char p[N],s[N];int main() { int t; cin>>t; while(t--) { cin>>p+1>>s+1; n=strlen(p+1); m=strlen(s+1); int ans=0; for(i... 阅读全文
posted @ 2020-02-29 18:10 晴屿
摘要:``` #include using namespace std; const int maxn = 1000010; int n; char a[maxn]; int ne[maxn]; void cal_next(char b[]) { for (int i=2,j=0;i<=n; i++) { while(j&& b[j+1]!=b[i]) j=ne[j]; if(b[j+1]==b[i]) 阅读全文
posted @ 2020-02-29 18:02 晴屿
摘要:string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,那么会返回一个特别的标记npos。(返回值可以看成是一个int型的数) 阅读全文
posted @ 2020-02-29 17:10 晴屿
摘要:``` #include #include using namespace std; const int N = 10010, M = 100010; int n, m; int ne[N];//ne[i] : 以i为结尾的部分匹配的值 char s[N], p[N]; int main() { while(cin>>s+1) { if(s[1]=='#') break; cin>>p+1; in 阅读全文
posted @ 2020-02-29 16:44 晴屿
摘要:``` #include #include using namespace std; const int N = 10010, M = 100010; int n, m; int ne[N];//ne[i] : 以i为结尾的部分匹配的值 char s[N], p[N]; int main() { int t; cin>>t; while(t--) { int ans=0; cin>>s+1>>p+ 阅读全文
posted @ 2020-02-29 16:32 晴屿
摘要:``` #include #include #include #include #include using namespace std; #define mod 360000 int a[200005],b[200005]; int c[200005],d[200005*2]; int ne[200005]; int sum; int main() { int n; cin>>n; for(in 阅读全文
posted @ 2020-02-29 16:25 晴屿
摘要:``` #include #include using namespace std ; const int N=1000000+10; int n,m; int ne[N]; int p[N],s[N]; int main() { int t; cin>>t; while(t--) { scanf("%d%d",&m,&n); for(int i=1; i<=m; i++) scanf("%d", 阅读全文
posted @ 2020-02-29 16:04 晴屿
摘要:``` #include using namespace std; typedef long long ll; typedef unsigned long long ull; const int maxn = 1e6; int col[maxn]; int num[maxn]; int vis[maxn]; int idx,h[maxn],e[maxn],ne[maxn]; int tl[maxn 阅读全文
posted @ 2020-02-28 22:56 晴屿
摘要:```#includeusing namespace std;const int maxn = 2*1e6+10;int ans[maxn],cnt[maxn],Ans = 0;int a[maxn],belong[maxn];struct xx{ int l,r,id,time;} Q[maxn];struct change{ int pos,val;} cge[maxn];int n,m;in... 阅读全文
posted @ 2020-02-28 22:20 晴屿
摘要:``` #include using namespace std; const int maxn=1e6+10; int n,m,block; long long a[maxn],cnt[maxn]; long long ans,s[maxn]; struct node { int l,r,id; }q[maxn]; bool cmp(node x,node y) { if(x.l/block!= 阅读全文
posted @ 2020-02-28 21:48 晴屿
摘要:``` //如果a[i]-1 和 a[i] + 1都没有维护过的话,那么就是多一个新串 //如果 a[i] - 1和a[i] + 1 有一个被维护过了,那么接上就好 //如果 a[i] -1 和a[i] + 1 都被维护过了,那么把两个合成一个,就少一个串 #include using namespace std; const int maxn=1e5+50; struct node{ int L 阅读全文
posted @ 2020-02-28 21:31 晴屿
摘要:https://blog.csdn.net/weixin_30337251/article/details/99742674 参考文章 阅读全文
posted @ 2020-02-28 19:42 晴屿
摘要:a[i]^a[i+1]……a[j]=k; 处理前缀和pre[i] 那么上式可以表示为pre[i 1]^pre[j]=k; 阅读全文
posted @ 2020-02-28 17:17 晴屿
摘要:#include<bits/stdc++.h> using namespace std; int n,m; struct node { int id; int slove; int pen; bool operator<(const node &b)const { //如果解决的数量和罚时都一样,就 阅读全文
posted @ 2020-02-23 13:56 晴屿
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll>pll; const int maxn=5e5+10; int n,m; int block; int a[maxn],belo 阅读全文
posted @ 2020-02-23 13:11 晴屿
摘要://预处理出以这个点为起点并跳出这个块的次数和位置 //更新一个点的弹力系数可以只更新这个点以及这个块内之前的点 #include<stdio.h> #include<algorithm> #include<string.h> #include<cmath> #include<iostream> u 阅读全文
posted @ 2020-02-23 11:52 晴屿
摘要:#include<bits/stdc++.h> using namespace std; const int N=1<<20; struct node{ int l,r; int id; }q[N]; int pos[N]; long long ans[N]; //每个前缀值出现的次数 long l 阅读全文
posted @ 2020-02-23 11:02 晴屿
摘要:#include<iostream> #include<cmath> using namespace std; const int maxn=1e5+7; //表示当前数在哪一块里面 int belong[maxn]; //每块的大小 int block; //一共多少块 int num; //这个 阅读全文
posted @ 2020-02-22 20:59 晴屿
摘要:参考博客:https://www.cnblogs.com/ivanovcraft/p/9019090.html #include<iostream> #include<cstdio> #define int long long using namespace std; const int maxn= 阅读全文
posted @ 2020-02-15 14:54 晴屿
摘要:————————————————版权声明:本文为CSDN博主「ModestCoder_」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/ModestCoder_/article/details/9013948 阅读全文
posted @ 2020-02-14 20:49 晴屿
摘要://tire的可持久化 //线段树的可持久化——主席树 //可持久化的前提:本身的拓扑结构在操作时不变 //可以存下来数据结构的所有历史版本 //核心思想:只记录每一个版本与前一个版本不一样的地方 // //s[i]=a[1]^a[2]^a[3]^...^a[n] //a[p]^a[p+1]^... 阅读全文
posted @ 2020-02-14 18:15 晴屿
摘要:————————————————版权声明:本文为CSDN博主「ModestCoder_」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/ModestCoder_/article/details/9013948 阅读全文
posted @ 2020-02-14 16:25 晴屿
摘要:#include<cstdio> #include<map> #include<algorithm> using namespace std; const int N=101010; struct Node { double x,yl,yh; int w; bool operator<(Node t 阅读全文
posted @ 2020-02-11 21:13 晴屿
摘要:参考 https://www.cnblogs.com/null00/archive/2012/04/22/2464876.html #include <stdio.h> #include <algorithm> #define LEN 10000 using namespace std; struc 阅读全文
posted @ 2020-02-11 20:36 晴屿
摘要://永远只考虑根节点的信息,说明在query时不会调用pushdown //所有操作均是成对出现,且先加后减 // #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vect 阅读全文
posted @ 2020-02-11 16:33 晴屿
摘要:#include <stdio.h> #include <algorithm> #include <iostream> #include <string.h> #include <set> #include <map> #include <vector> #include <queue> #incl 阅读全文
posted @ 2020-02-11 13:58 晴屿
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int INF=0x3f3f3f3f; const int N=50000+10; struct 阅读全文
posted @ 2020-02-11 13:23 晴屿
摘要:#include<iostream> #include<cstring> #include<cstdio> #include<math.h> #include<algorithm> using namespace std; typedef long long ll; const int N=1e5+ 阅读全文
posted @ 2020-02-11 10:14 晴屿
摘要:#include<stdio.h> #include<iostream> #include<string.h> #include<algorithm> using namespace std; const int MAXN=8010; struct Node { int l,r; int color 阅读全文
posted @ 2020-02-11 09:43 晴屿
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MAXN 50010 int n , q; int h[MAXN]; struct Node{ 阅读全文
posted @ 2020-02-11 09:39 晴屿
摘要:#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int N=1e5+10; struct node{ 阅读全文
posted @ 2020-02-11 08:53 晴屿
摘要://线段树区间覆盖 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int N=100010; int flag; struct node{ in 阅读全文
posted @ 2020-02-11 07:50 晴屿
摘要://add,懒标记,给以当前节点为根的子树中的每一个点加上add(不包含根节点) // #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef 阅读全文
posted @ 2020-02-11 06:47 晴屿
摘要:和Disharmony Trees HDU - 3015神似 // max(vi,vj) * |posi - posj| #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; typedef lon 阅读全文
posted @ 2020-02-09 21:54 晴屿
摘要:#include<iostream> #include<cstring> using namespace std; const int N = 100005; int tr[N]; int lowbit(int x) { return x&(-x); } void add(int x,int a) 阅读全文
posted @ 2020-02-09 21:38 晴屿
摘要:#include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; struct node { ll x,h; } Tr[100005]; int n,tr1[100005] 阅读全文
posted @ 2020-02-09 21:23 晴屿
摘要:#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using namespace std; typedef long long ll; const int N=1e5+10; int a[N]; int 阅读全文
posted @ 2020-02-09 19:50 晴屿
摘要://每个数字只会被它后面的比它小的数字影响,且会向右移动相应个数的位置 //比如:6 4 3 5 2 1 。4后面比它小的有 三个,因此它的最右边位置就是当前位置 +3,即5 //如果该数字本身在标准位置左边,那无须考虑,初始位置就是最左端 //如果它在标准位置右边,我们可以知道,它最终肯定要回到标 阅读全文
posted @ 2020-02-09 19:28 晴屿
摘要:#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef long long ll; const int N=5e5+10; int n; int a[ 阅读全文
posted @ 2020-02-08 23:32 晴屿
摘要:#include<cstdio> #include<cstring> using namespace std; typedef long long ll; const ll mod=1e9+7; const int N=1005; ll c[N][N]; char op[5]; int lowbit 阅读全文
posted @ 2020-02-08 22:54 晴屿
摘要:#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using namespace std; const int N=32005; int a[N]; int tr[N]; int level[N]; i 阅读全文
posted @ 2020-02-08 22:46 晴屿
摘要:#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=100010; int a[N]; int tr[N]; int n,m; int l,r; int lowbit(in 阅读全文
posted @ 2020-02-08 22:34 晴屿
摘要:#include<iostream> #include<cstring> using namespace std; const int N=2e5+10; int m,n,p; struct node{ int l,r; int v; }tr[N*4]; void pushup(int u) { t 阅读全文
posted @ 2020-02-08 20:18 晴屿
摘要:#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef long long LL; const int N = 50005; int n; i 阅读全文
posted @ 2020-02-08 19:24 晴屿
摘要:#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N=2e5+10; int n,m; int p[N]; struct edge{ int a,b; int w; }e[N 阅读全文
posted @ 2020-02-08 17:56 晴屿
摘要:#include<iostream> #include<cstring> #include<cstdio> using namespace std; const int N=200000+10; int p[N]; int w[N]; int find(int x) { if(p[x]==x) re 阅读全文
posted @ 2020-02-08 17:27 晴屿
摘要://有n个成员,并查集开两倍空间 //1~n为一组, n+1~2n为一组。a与b互斥,则a与b反(即b+n)为同一集合, //同时b与a反(a+n)为同一集合 //在union操作中,引入w ,w越大,表面它的根连接的点越多 //合并时确立关系 #include<iostream> using na 阅读全文
posted @ 2020-02-08 14:01 晴屿
摘要:#include<iostream> #include<cstring> using namespace std; const int N=1010; int p[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x]); return p[x]; } in 阅读全文
posted @ 2020-02-08 13:37 晴屿
摘要:#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<string> #include<map> typedef long long ll; using namespace std; in 阅读全文
posted @ 2020-02-07 21:39 晴屿
摘要:#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=1e5; int a,b; int p[N+10]; // 标记走过的房间 bool vis[N+10]; int fi 阅读全文
posted @ 2020-02-02 11:44 晴屿
摘要:#include<iostream> #include<cstring> #include<stdio.h> #include<map> #include<vector> #define cle(a) memset(a,0,sizeof(a)) using namespace std; const 阅读全文
posted @ 2020-02-01 23:22 晴屿
摘要:#include<iostream> #include<cmath> #include<algorithm> using namespace std; const int N=4e4+10; // 东西 南北 int p[N],D[N],B[N]; struct node{ int x,y,d; c 阅读全文
posted @ 2020-02-01 21:21 晴屿
摘要:#include<iostream> #include<algorithm> #include<cstdio> using namespace std; const int N=10010<<1; struct node { int l,r,ans; } q[N]; int a[N],fa[N],d 阅读全文
posted @ 2020-02-01 20:09 晴屿
摘要:#include<iostream> #include<algorithm> using namespace std; const int N=1e5; struct edge{ int w; int deadline; }e[N]; bool cmp(edge a,edge b) { return 阅读全文
posted @ 2020-02-01 19:57 晴屿
摘要:#include<iostream> #include<cstring> using namespace std; const int N=200010; int d[N],p[N]; int find(int x) { if(p[x]!=x) { int root=find(p[x]); d[x] 阅读全文
posted @ 2020-02-01 17:25 晴屿
摘要:#include<iostream> using namespace std; const int N=1010; int p[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x]); return p[x]; } int main() { int t; 阅读全文
posted @ 2020-02-01 15:28 晴屿
摘要:#include<iostream> using namespace std; const int N=30010; int n,m,ans,p[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x]); return p[x]; } int main() 阅读全文
posted @ 2020-02-01 15:23 晴屿
摘要:#include<iostream> #include<cstdio> using namespace std; const int N=100010; int p[N]; int d[N]; int find(int x) { if(p[x]!=x) { int u=find(p[x]); d[x 阅读全文
posted @ 2020-02-01 15:16 晴屿
摘要:#include<iostream> #include<cmath> using namespace std; const int N=1010; int dx[N],dy[N]; int p[N]; int repair[N]; int n; int d; double get(int a,int 阅读全文
posted @ 2020-02-01 14:40 晴屿