- 博客(22)
- 资源 (2)
- 收藏
- 关注
原创 [特征根法 || 高斯消元] 51Nod 1653 算法马拉松19 E 夹克赌坊
这道题先是很happy的打了个高斯消元#include#include#include#include#define cl(x) memset(x,0,sizeof(x))using namespace std;typedef long double ld;const int N=200005;const ld eps=1e-15;int S,W,A,n;ld
2016-10-31 18:18:05 574
原创 [暴力 乱搞] 51Nod 1501 算法马拉松19 D 石头剪刀布威力加强版
这种东西找循环就好了#include#include#includeusing namespace std;typedef long long ll;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin
2016-10-31 18:13:20 627
原创 [数学] 51Nod 1622 算法马拉松19 C 集合对
运用数学知识可知A交B的所有子集皆可#include#include#includeusing namespace std;typedef long long ll;const ll P=1e9+7;ll a,b,c;inline ll Pow(ll a,ll b){ ll ret=1; for (;b;b>>=1,a=a*a%P) if (b&1)
2016-10-31 18:12:14 318
原创 [暴力 乱搞] 51Nod 1616 算法马拉松19 B 最小集合
从后往前枚举 看他的所有倍数gcd是否是他自己#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1
2016-10-31 18:10:47 329
原创 [暴力 乱搞] 51Nod 1674 算法马拉松19 A 区间的价值 V2
因为每个点向前and 向前or 的后缀值是O(32) 所以可以暴力分段求和 32n类似的还有后缀gcd 是O(logV)的#include#include#includeusing namespace std;typedef long long ll;inline char nc(){ static char buf[100000],*p1=buf,*p2=bu
2016-10-31 18:08:42 372
原创 [二分图 dfs 打标记] BZOJ 4424 Cf19E Fairy
二分图不能有奇环那么这条边一定在奇环的交上 还不能在偶环上 因为偶环和奇环会组成新的奇环那么给奇环打+1标记 偶环打-1标记 标记为奇环个数的边即可这种打标记的树D方法比较重要#include#include#include#include#define cl(x) memset(x,0,sizeof(x))using namespace std;inline
2016-10-31 18:05:43 847
原创 [拓扑排序] BZOJ 2535 [Noi2010]Plane 航空管制2 & 2109 [Noi2010]Plane 航空管制
用拓扑排序搞最早什么时候起飞就倒过来建反图然后一个劲的从后面加直到不能加为止#include#include#include#include#include#define cl(x) memset(x,0,sizeof(x))using namespace std;typedef pair abcd;inline char nc(){ static char
2016-10-31 18:02:22 598
原创 [堆 贪心] Canada Cup 2016 D. Contest Balloons
不想多说#include#include#include#includeusing namespace std;typedef long long ll;typedef pair abcd;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fr
2016-10-31 17:58:48 288
原创 [构造] Canada Cup 2016 C. Hidden Word
链接:http://codeforces.com/contest/725/problem/CEach English letter occurs at least once in s.!!没看见!! 然后写爆搜剪枝写到爆炸#include#include#includeusing namespace std;inline char nc(){ stat
2016-10-31 17:57:35 242
原创 [近似算法 分治] UER #7 B.天路
vfk的题解没看懂 羞...#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) ret
2016-10-31 17:54:31 369
原创 [DP 决策单调性 || 贪心] UER #7 A.短路
先是写了个决策单调性DP然后知道能贪心 就没写了#include#include#includeusing namespace std;typedef long long ll;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(bu
2016-10-31 17:53:09 332
原创 [双连通分量 缩点 并查集] POJ 3177 Redundant Paths & 3352 Road Construction
双连通分量缩点 并查集 竟然是第一次打缩点后是一棵树结论是(叶子节点+1)>>1 也就是每次取lca最浅的两个叶子连边#include#include#include#include#define cl(x) memset(x,0,sizeof(x))using namespace std;inline char nc(){ static char buf
2016-10-28 08:20:59 387
原创 [扫描线 线段树上二分] BZOJ 4411 [Usaco2016 Feb]Load balancing
第一维扫描线第二维线段树上二分好久之前的代码了#include#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,10000,std
2016-10-23 12:14:47 626
原创 [DP || 贪心 链表] BZOJ 4576 [Usaco2016 Open]262144 & BZOJ 4580 [Usaco2016 Open]248
有意思的一道题官网上的做法是f[i][j]表示从j出发能够合并出i的末端 不存在则为0然后就可以转移了这有什么好呢 短#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=
2016-10-23 12:14:26 425
原创 [非旋转Treap 神奇复杂度分析] Hillan模拟赛 D.理性愉悦
将所有询问建成一颗平衡树每次分裂成两棵 右边打个减标记然后怎么合并呢要是右边最小值大于左边最大值 那么直接合并要是不呢 我们不断从右边弹出最小插入左边 直到可以合并暴力合并的复杂度怎么证呢可以通过与prize的关系 发现右边的数减去prize后肯定小于原来的一半 每个数最多从右边到左边log次复杂度就是nlogn了#include#include#
2016-10-23 10:34:14 726
原创 [dfs 离线] Hillan模拟赛 C.可持久化的书橱
可以根据关系连边 形成树结构 然后dfs+回溯#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1
2016-10-23 10:29:17 403
原创 [环 链 DP] Hillan模拟赛 B.或异或
因为每个点不超过两次 两两连边 发现是一些环和链相互独立然后就是在环链上DP 注意一些细节#include#include#include#include#define cl(x) memset(x,0,sizeof(x))using namespace std;typedef long long ll;inline char nc(){ static char
2016-10-23 10:26:32 374
原创 [FFT 压位] Hillan模拟赛 A.简单字符串匹配
前几个点么 标算给的分块FFT n^1.5 logn 我怎么打都不过压压位开氧气卡过去最后一个点么 把A串转过来 FFT#include#include#include#includeusing namespace std;typedef long long ll;inline char nc(){ static char buf[100000],*p1=bu
2016-10-23 10:23:00 939
原创 [Emacs] 我的Emacs配置文件 for OI
自己整理的emacs配置文件好吧每次考试前都要手写60+行的配置了;;启动设置(setq default-frame-alist '((vertical-scroll-bars) (top . 25) (left . 45) (width . 120)
2016-10-11 19:51:57 874
原创 [并查集 构造] Codeforces 723F#375 (Div. 2) F. st-Spanning Tree
并查集乱搞的构造竟然因为return printf的返回值 无限RE#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,10000,st
2016-10-09 08:19:43 464
原创 [欧拉回路 构造 || 网络流] Codeforces 723E #375 (Div. 2) E. One-Way Reform
通过欧拉回路构造 称度为偶数的点为偶点 度为奇数为奇点偶点可以满足条件 而奇点不能肯定可以通过只加奇点之间的边使得存在欧拉回路然后求欧拉回路 把加的边删去 对偶点无影响那么就能使所有偶点满足条件网络流?我不是很会网络流的做法#include#include#include#include#define cl(x) memset(x,0,sizeo
2016-10-05 21:14:06 622
原创 [贪心] Codeforces 723C #375 (Div. 2) C. Polycarp at the Radio
乱贪心一通#include#include#include#includeusing namespace std;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==p2){ p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) retu
2016-10-05 21:09:43 304
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人