摘要: 一、代码: 1、求逆元(原理貌似就是拓展欧几里得,要求MOD是素数): 2、底层优化(正确性未验证): 3、扩栈,这玩意儿在OJ上用能防爆? 4、神速读入fread 二、神牛blog matrix67 ZKW watashi 三、专题 动态规划系列: 数位dp模板 字符串系列: 【专辑】AC自动机 阅读全文
posted @ 2013-08-14 23:48 Oyking 阅读(1273) 评论(0) 推荐(0) 编辑
摘要: DescriptionN(3 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 20010; 9 10 struct Node {11 int val, id;12 bool operator 0) {29 ret += tree[k];30 k -= lowbit(k);31 }32 return ret;33 }34 35 inline void modify(int... 阅读全文
posted @ 2013-08-14 23:22 Oyking 阅读(315) 评论(0) 推荐(0) 编辑
摘要: DescriptionJohn is the only priest in his town. October 26th is the John's busiest day in a year because there is an old legend in the town that the couple who get married on that day will be forever blessed by the God of Love. This year N couples plan to get married on the blessed day. The i-th 阅读全文
posted @ 2013-08-14 22:09 Oyking 阅读(354) 评论(0) 推荐(0) 编辑
摘要: DescriptionFor a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation.Given a complete grap... 阅读全文
posted @ 2013-08-14 20:33 Oyking 阅读(340) 评论(0) 推荐(0) 编辑
摘要: DescriptionSheryl works for a software company in the country of Brada. Her job is to develop a Windows operating system. People in Brada are incredibly conservative. They even never use graphical monitors! So Sheryl’s operating system has to run in text mode and windows in that system are formed by 阅读全文
posted @ 2013-08-14 18:41 Oyking 阅读(1140) 评论(0) 推荐(0) 编辑
摘要: There arenpsychos standing in a line. Each psycho is assigned a unique integer from1ton. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step.You're given the i 阅读全文
posted @ 2013-08-14 15:48 Oyking 阅读(876) 评论(0) 推荐(0) 编辑
摘要: Yaroslav has an arrayp = p1, p2, ..., pn(1 ≤ pi ≤ n), consisting ofndistinct integers. Also, he hasmqueries:Query numberiis represented as a pair of integersli,ri(1 ≤ li ≤ ri ≤ n).The answer to the queryli, riis the number of pairs of integersq,w(li ≤ q, w ≤ ri)such thatpqis the divisor ofpw.Help Ya 阅读全文
posted @ 2013-08-14 12:26 Oyking 阅读(897) 评论(0) 推荐(1) 编辑