摘要: 在考场上我们可以打表发现规律是 $ ab a b $ 。下面给出证明(看的网上的)。 若有正数 $ x $ 不能被 $ a $ , $ b $ 组合出,假设 $ a b $ ,则存在 $$ x=ap+bq=a(p b)+b(q+a) $$ 其中 $ p 0, q0 $ 。 为什么呢?如果学过exgc 阅读全文
posted @ 2017-12-01 11:44 poorpool 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 1日 luogu 2627 luogu 2951 NOIP2017D1T1 luogu 1262 luogu 2863 2日 luogu 2865 3日 luogu 2901 poj 2449 4日 luogu 3388 luogu 3369 poj 2985 vijos 1459 5日 luogu 阅读全文
posted @ 2017-12-01 11:17 poorpool 阅读(181) 评论(2) 推荐(0) 编辑
摘要: 设dp[i]表示i位置不选且i之前的都合法的最小损失值。 cpp include include include using namespace std; typedef long long ll; //dp[i] = min{dp[j]} + w[i] | i j i k 1 n k; for(i 阅读全文
posted @ 2017-12-01 11:15 poorpool 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 单调队列 cpp include include using namespace std; int n, l, r, dp[400005], a[200005], q[200005], hea, tai; //dp[i] = max{dp[k]} + w[i] | i r n l r; for(in 阅读全文
posted @ 2017-11-30 20:44 poorpool 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 单调队列优化dp cpp include include using namespace std; int dp[1000005], n, m, q[1000005], l, r, w[1000005]; //dp[i] = dp[j] + w[i] | i m n m; for(int i=1; 阅读全文
posted @ 2017-11-30 20:06 poorpool 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 模板题 cpp include include include using namespace std; int l1=1, r1, l2=1, r2, q1[1000005], q2[1000005], a[1000005], n, k; int ans1[1000005], ans2[10000 阅读全文
posted @ 2017-11-30 19:38 poorpool 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 找两个异或和最大的数 很容易想到trie树维护二进制 cpp include include include using namespace std; typedef long long ll; struct Node{ ll son[2], idd; bool hav[2]; Node(){ so 阅读全文
posted @ 2017-11-30 19:07 poorpool 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 模板题 cpp include include include using namespace std; struct Node{ int cnt, son[29]; bool hav; Node(){ cnt = hav = 0; } }trie[500005]; int c, n, m, len 阅读全文
posted @ 2017-11-29 20:14 poorpool 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 先manacher。然后前缀和价值,枚举切点,O(1)判断切后是否回文 阅读全文
posted @ 2017-11-28 21:03 poorpool 阅读(159) 评论(0) 推荐(0) 编辑
摘要: manacher模板题。 这里推荐 "这篇博文" ,讲得很清晰,一下就懂了。 阅读全文
posted @ 2017-11-28 19:51 poorpool 阅读(124) 评论(0) 推荐(0) 编辑