2014年4月10日

zwei

摘要: 模拟9 T2(COGS上也有,链接http://218.28.19.228/cogs/problem/problem.php?pid=1427)题目描述 维护一个数组a[i],支持两个操作,数组从1开始下标。 1. 将a[x]修改成y。 2. 求l到r之间所有数的异或和。分析 这个接近于裸题了,线段树树状数组什么的随意。(其实经亲测,在COGS上暴力都能过,但cena过不了) 知道0⊕b = b, a⊕b⊕a = b,就差不多了。 ps:顺便说一句,从这道题开始,突然就爱上了打DP,AC率那真是瞬间大了好多。 这个是用线段树写的: 1 /*********************... 阅读全文

posted @ 2014-04-10 21:36 AlanXue 阅读(455) 评论(0) 推荐(0) 编辑

drei

摘要: 模拟9 T3(COGS上也有,链接http://218.28.19.228/cogs/problem/problem.php?pid=1428)题目描述 输入a,p,求最小正整数x,使得a^x mod p = 1。分析 神奇的欧拉定理(对于gcd(a,n)= 1) 特殊情况单独判 不特殊的话,先求phi(p) 之后,ans一定是p的因数(这个不会证明T^T) 于是,就把phi(p)一个质因数一个质因数的试试,能除出来就除出来,剩的就是最小的。 (无视那个逗比的素数表,那只是模仿ZZX的习惯而已←_←) 1 /*****************************... 阅读全文

posted @ 2014-04-10 21:21 AlanXue 阅读(2233) 评论(0) 推荐(0) 编辑

2014年4月7日

Andrew

摘要: 1 /************************************************** 2 Target: Andrew ——Convex Hull 3 Author: Xue Zhonghao 4 Date: 2014-04-07 12:24:54 5 **************************************************/ 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 12 #defin... 阅读全文

posted @ 2014-04-07 16:56 AlanXue 阅读(133) 评论(0) 推荐(0) 编辑

Aho-CorasickAutomaton

摘要: 1 /**************************************************************************************************** 2 Target: To realize the Aho-CorasickAutomaton 3 Author: Xue Zhonghao 4 Date: Forgotten (Before 2014-3-11 19:54:42) 5 ***********************************************... 阅读全文

posted @ 2014-04-07 16:55 AlanXue 阅读(234) 评论(0) 推荐(0) 编辑

Bipartite Graph Match 2

摘要: /**************************************************************************************************** Target: Bipartite Graph Match (According to the problem named "star") O(nlog(n)) —— From WZJ Author: Xue Zhonghao ... 阅读全文

posted @ 2014-04-07 16:54 AlanXue 阅读(196) 评论(0) 推荐(0) 编辑

Bipartite Graph Match

摘要: 1 /**************************************************************************************************** 2 Target: Bipartite Graph Match (According to the problem named "star") O(n*n) 3 Author: Xue Zhonghao 4 Date: 2014-3-11 19:15:20 5 ********************************... 阅读全文

posted @ 2014-04-07 16:53 AlanXue 阅读(402) 评论(0) 推荐(0) 编辑

KMP

摘要: 1 /************************************************** 2 Target: kmp function 3 Author: Xue Zhonghao 4 Date: 2014-2-28 19:28:17 5 **************************************************/ 6 7 #include 8 #include 9 #include10 #include11 using namespace std;12 13 #define max... 阅读全文

posted @ 2014-04-07 16:52 AlanXue 阅读(158) 评论(0) 推荐(0) 编辑

Treap

摘要: 1 /************************************************** 2 Target: Treap 3 Author: Xue Zhonghao 4 Date: 2014-4-3 17:53:22 5 **************************************************/ 6 #include 7 #include 8 //#include 9 using namespace std;10 //ifstream fin("input.txt");11 //of... 阅读全文

posted @ 2014-04-07 16:51 AlanXue 阅读(140) 评论(0) 推荐(0) 编辑

Priority queue

摘要: 1 /************************************************** 2 Target: To realize the Priority_queue 3 Author: Xue Zhonghao 4 Date: 2014-3-5 21:30:34 5 **************************************************/ 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 12... 阅读全文

posted @ 2014-04-07 16:47 AlanXue 阅读(133) 评论(0) 推荐(0) 编辑

Trie

摘要: 1 /************************************************** 2 Target: Trie 3 Author: Xue Zhonghao 4 Date: 2014-3-17 19:50:56 5 **************************************************/ 6 #include 7 #include 8 #include 9 using namespace std;10 11 #define maxnode 100012 13 struct ... 阅读全文

posted @ 2014-04-07 16:38 AlanXue 阅读(152) 评论(0) 推荐(0) 编辑

导航