05 2017 档案

scau 18087 开始我是拒接的 mobius
摘要:其实有一个很有用的技巧就是,把gcd = 4的贡献,压去gcd = 2时的贡献,就不需要考虑这么多的了。 为什么可以把gcd = 4的,压去gcd = 2的呢,gcd = 12的,压去gcd = 6的去算呢, 其实这就是mobius的容斥原理,mu[4] = 0,mu[12] = 0, 例如: ht 阅读全文

posted @ 2017-05-29 23:52 stupid_one 阅读(395) 评论(0) 推荐(0) 编辑

bzoj 2301: [HAOI2011]Problem b mobius反演 RE
摘要:http://www.lydsy.com/JudgeOnline/problem.php?id=2301 设f(i)为在区间[1, n]和区间[1, m]中,gcd(x, y) = i的个数。 设F(i)为在区间[1, n]和区间[1, m]中,gcd(x, y) % i == 0的个数,很简单的公 阅读全文

posted @ 2017-05-25 00:04 stupid_one 阅读(217) 评论(0) 推荐(0) 编辑

E. Selling Souvenirs 不会做
摘要:http://codeforces.com/contest/808/problem/E 不理解为什么dp = {cost, cnt1, cnt2}可以 而dp = {cost, cnt1, cnt2, cnt3}不可以 上面那个不可以的例子是: 但是这个dp是可行的,只是还有一个更新没实现起来。 d 阅读全文

posted @ 2017-05-19 10:29 stupid_one 阅读(247) 评论(4) 推荐(0) 编辑

D. Array Division
摘要:http://codeforces.com/contest/808/problem/D 一开始是没什么想法的,然后回顾下自己想题的思路,慢慢就想出来了。首先要找到是否有这样的一个位置使得: 前缀和 == 后缀和,可以二分来求。 然后可以这样想,如果对于每一个数字,我都去移动一下,每个位置都试一下,复 阅读全文

posted @ 2017-05-17 17:05 stupid_one 阅读(288) 评论(0) 推荐(0) 编辑

Magic Maze dfs + dp
摘要:http://swjtuoj.cn/problem/2387/ 设dp[cur]表示以cur这个节点为起点的时候,能走的最大贡献。 题目保证没环,也就是没回路。 感觉和树dp差不多了。 #include <cstdio> #include <cstdlib> #include <cstring> # 阅读全文

posted @ 2017-05-15 21:06 stupid_one 阅读(144) 评论(0) 推荐(0) 编辑

swjtu oj Paint Box 第二类斯特林数
摘要:http://swjtuoj.cn/problem/2382/ 题目的难点在于,用k种颜色,去染n个盒子,并且一定要用完这k种颜色,并且相邻的格子不能有相同的颜色, 打了个表发现,这个数是s(n, k) * k! s(n, k)表示求第二类斯特林数。 那么关键是怎么快速求第二类斯特林数。 这里提供一 阅读全文

posted @ 2017-05-15 00:23 stupid_one 阅读(432) 评论(0) 推荐(0) 编辑

B -- RE:从零开始的异世界生活 线段树
摘要:http://www.ifrog.cc/acm/problem/1117?contest=1016&no=1 其实我是第一次这样用线段树。 首先把所有出现过的数字全部离散化。那么数字就是从[1, 100000]了。 把他们看成一个个独立的节点。每次插入一个数字,就在那个位置加1. 那么线段树维护区间 阅读全文

posted @ 2017-05-13 21:00 stupid_one 阅读(451) 评论(5) 推荐(0) 编辑

EOJ Problem #3261 分词 trie + dp + 小剪枝
摘要:http://acm.ecnu.edu.cn/problem/3261/ 分词 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes 分词 Time limit p 阅读全文

posted @ 2017-05-13 13:30 stupid_one 阅读(377) 评论(0) 推荐(0) 编辑

129. 笔芯值
摘要:https://scut.online/p/129 一开始的错误思路: 考虑每一个数的贡献,一个数a[i],当且仅当它的区间包含a[i] - 1和a[i] + 1,这个数的贡献变成0. 那么可以找到对于每一个数a[i],他的a[i] - 1和a[i] + 1在哪里。然后处理一些细节。 但是这个细节是 阅读全文

posted @ 2017-05-11 16:18 stupid_one 阅读(157) 评论(0) 推荐(0) 编辑

F. Coprime Subsequences 莫比乌斯反演
摘要:http://codeforces.com/contest/803/problem/F 这题正面做了一发dp dp[j]表示产生gcd = j的时候的方案总数。 然后稳稳地超时。 考虑容斥。 总答案数是2^n - 1 那么需要减去gcd = 2的,减去gcd = 3的,减去gcd = 5的。加上gc 阅读全文

posted @ 2017-05-06 21:40 stupid_one 阅读(273) 评论(0) 推荐(0) 编辑

F. Clique in the Divisibility Graph DP
摘要:http://codeforces.com/contest/566/problem/F F. Clique in the Divisibility Graph time limit per test 1 second memory limit per test 256 megabytes input 阅读全文

posted @ 2017-05-01 20:34 stupid_one 阅读(409) 评论(0) 推荐(0) 编辑

D. Restructuring Company 并查集 + 维护一个区间技巧
摘要:http://codeforces.com/contest/566/problem/D D. Restructuring Company time limit per test 2 seconds memory limit per test 256 megabytes input standard 阅读全文

posted @ 2017-05-01 18:50 stupid_one 阅读(411) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示