上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 57 下一页

2017年5月13日

B -- RE:从零开始的异世界生活 线段树

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

posted @ 2017-05-13 21:00 stupid_one 阅读(457) 评论(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 阅读(387) 评论(0) 推荐(0)

2017年5月11日

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 阅读(165) 评论(0) 推荐(0)

2017年5月6日

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 阅读(279) 评论(0) 推荐(0)

2017年5月1日

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 阅读(438) 评论(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 阅读(419) 评论(0) 推荐(0)

2017年4月29日

scut 125. 笔芯回文

摘要: https://scut.online/p/125 看数据量,这题可能是O(n^2)的dp 也可能是区间dp,但是区间dp一般复杂度是O(n^3),虽然也可以优化,但是比赛的时候那么多人“秒”了,应该不会是那么麻烦的。 套路:设dp[i]表示前i个字符中能拿到的最大贡献。dp[len]就是答案。 如 阅读全文

posted @ 2017-04-29 22:49 stupid_one 阅读(162) 评论(0) 推荐(0)

2017年4月26日

BZOJ 2440: [中山市选2011]完全平方数 二分答案 + 容斥原理 + 莫比乌斯反演

摘要: http://www.lydsy.com/JudgeOnline/problem.php?id=2440 第一道莫比乌斯反演的题目。 二分答案 + 容斥那里还是挺好想的。 二分一个答案val,需要[1, val]之间存在的合法数字个数 >= k即可。 怎么判断呢?可以容斥,开始的时候有ans = v 阅读全文

posted @ 2017-04-26 19:36 stupid_one 阅读(189) 评论(0) 推荐(0)

Prime Count 求大区间素数个数

摘要: http://acm.gdufe.edu.cn/Problem/read/id/1333 https://www.zhihu.com/question/29580448/answer/44874605 阅读全文

posted @ 2017-04-26 15:43 stupid_one 阅读(279) 评论(0) 推荐(0)

2017年4月25日

D、Homework of PE 容斥原理

摘要: https://scut.online/p/113 终于想懂了这个容斥, 华工4月23号校赛,考虑总的所有情况,设1 n里面含有质数的个数为all,需要固定m个质数。那么有 totSum = C(all, m) * (n - m)!,就是在all个质数里面,任意选m个出来固定,剩下的全排。 但是算多 阅读全文

posted @ 2017-04-25 14:00 stupid_one 阅读(274) 评论(0) 推荐(0)

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 57 下一页

导航