2020年2月3日

摘要: 开局一张图,剩下全靠编。 对于树状数组,我的理解是有技巧的应用前缀和+神仙一般的二进制规律 1、改点求段 改点从下往上,将全部包括了这个点的c全部更改 1 int lowbit(int x) 2 { 3 return x&(-x); 4 } 1 void add(int x,int y)//将第x个 阅读全文
posted @ 2020-02-03 19:52 greenofyu 阅读(125) 评论(0) 推荐(0)
摘要: 1 #include<iostream> 2 using namespace std; 3 const int N=4e5+100; 4 struct edge 5 { 6 int from; 7 int to; 8 int nex; 9 }; 10 edge a[N]; 11 int head[N 阅读全文
posted @ 2020-02-03 16:11 greenofyu 阅读(186) 评论(0) 推荐(0)

2020年2月1日

摘要: 先写所谓的种类并查集。 就是开3*n的空间,前n为A,后边依次是B,C 食物链为A->B->C->A 对于每句话都是先判断是否合法,然后在改并查集就好了 1 #include<iostream> 2 #include<fstream> 3 using namespace std; 4 const i 阅读全文
posted @ 2020-02-01 16:21 greenofyu 阅读(163) 评论(0) 推荐(0)
摘要: 1 #include<iostream> 2 #include<cstring> 3 #include<climits> 4 #include<algorithm> 5 using namespace std; 6 struct edge 7 { 8 int x,y,t; 9 }a[100009]; 阅读全文
posted @ 2020-02-01 10:48 greenofyu 阅读(280) 评论(0) 推荐(0)

2020年1月27日

摘要: 最大正方形 1 //找出一个01矩阵中最大的全为一的正方形,并输出边长 2 #include <iostream> 3 #include<cstdio> 4 #include<cstdlib> 5 #include<cmath> 6 #include<cstring> 7 #include<algo 阅读全文
posted @ 2020-01-27 15:34 greenofyu 阅读(182) 评论(0) 推荐(0)

2020年1月26日

摘要: 直接干 1 #include<iostream> 2 #include<algorithm> 3 #include<climits> 4 using namespace std; 5 struct edge 6 { 7 int from,to,weight; 8 }a[100010];//存边 9 阅读全文
posted @ 2020-01-26 11:37 greenofyu 阅读(153) 评论(0) 推荐(0)
摘要: 从邻接矩阵中提取出边,然后跑一边kruscal 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 struct node 5 { 6 int x,y,w; 7 }; 8 int cnt=0;//记录边数 9 nod 阅读全文
posted @ 2020-01-26 11:08 greenofyu 阅读(211) 评论(0) 推荐(0)

2020年1月24日

摘要: 博弈论是真的难!? 给你两个数,每次只能从大的那个减去小的数的正整数倍,先得到零的人获胜 分析一下,(假设为x,y,且x>y),x=ky+z,若k>=2,那么我(是不是就可以为所欲为了)想一下减完或者,留一个给对手减是不是都行,然后我再往后分析下,我不就必胜了么? 所以遇到了这种情况或者我可以直接赢 阅读全文
posted @ 2020-01-24 13:07 greenofyu 阅读(231) 评论(0) 推荐(0)
摘要: 转载自https://blog.csdn.net/Brian_Pan_/article/details/103860752 可以把环想象成两条路,如果没有天生的0,那两条路就是一样的(如果有的话,就两个方向跑一遍,奇数个非零alice必胜) 如果是偶数个的话,就没有必胜的策略了,只能根据bob所走的 阅读全文
posted @ 2020-01-24 11:03 greenofyu 阅读(241) 评论(0) 推荐(0)

2020年1月23日

摘要: 1 //并查集判联通,dfs求解欧拉回路 2 #include<iostream> 3 using namespace std; 4 const int N=150; 5 int mp[N][N];//邻接矩阵存图 6 int d[N];//点的度数 7 char res[N*N];//大于C(52 阅读全文
posted @ 2020-01-23 21:36 greenofyu 阅读(171) 评论(0) 推荐(0)