Codeforces Round #189 (Div. 1 + Div. 2)
A. Magic Numbers
- 不能出现连续的3个4,以及1、4以外的数字。
B. Ping-Pong (Easy Version)
- 暴力。
C. Malek Dance Club
- 考虑\(x\)二进制每一位1,假设位置为\(p\),则前\(p-1\)位都需要一样,否则之前就计算了贡献,那么后面的位可以任取。
D. Psychos in a Line
- 链表模拟。
E. Kalila and Dimna in the Logging Industry
- 因为\(b_n=0\),所以用最小代价砍倒第\(n\)棵树即可。
- \(dp(i)\)表示砍掉第\(i\)棵树的最小代价。
- \[dp(i)=min\{dp(k)+b_k\cdot a_i\}\]
- 斜率优化。
F. Have You Ever Heard About the Word?
- 删除次数最多\(\sqrt n\)次。
- 假设当前的删除长度为\(len\),每隔\(len\)取一个关键点\(p\),如果存在可删除串,则\(p\)和\(p+len\)的最长前缀和最长后缀之和大于\(len\),通过二分+hash可以\(logn\)计算。
G. Ping-Pong
The length of the new interval is guaranteed to be strictly greater than all the previous intervals.
- 对于\(a<b\),\(|I_a|<|I_b|\),区间\(a\)和区间\(b\)要么相互可达,要么区间\(a\)完全被区间\(b\)完全包含。
- 利用线段树+并查集维护相互可达的区间。
- 判断\(a\)是否可达\(b\):
- 相互可达,即属于同一集合。
- 区间\(a\)的端点是否被\(b\)集合包含。
- 满足上面其中一点说明\(a\)可达\(b\),否则不可达。
Codeforces Round #189 (Div. 1 + Div. 2)的更多相关文章
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 39 (Rated for Div. 2) G
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
- Educational Codeforces Round 60 (Rated for Div. 2) 题解
Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...
随机推荐
- OpenLayers添加地图标记
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head ...
- day4new-转自金角大王
Python之路,Day4 - Python基础4 (new版) 本节内容 迭代器&生成器 装饰器 Json & pickle 数据序列化 软件目录结构规范 作业:ATM项目开发 ...
- concurrent模块
concurrent包 concurrent.futrues模块 3.2版本引入 异步并行任务模块,提供一个高级的异步可执行的便利接口. 提供了两个池执行器 ThreadPoolExecutor异步调 ...
- jquery find 推荐
https://codeplayer.vip/p/j7soa 这篇写的还是不错的,备用. // 返回jQuery对象所有匹配元素的标识信息数组 // 每个元素形如:tagName或tagName#id ...
- JavaSript中的正则表达式
正则表达式是对字符串操作的逻辑公式,表达了对字符串的一种过滤逻辑. 相对于.NET和Perl,JS对正则表达式的支持相当朴素,或者说JS的正则表达式是perl正则表达式的一个子集. 一.正则表达式引擎 ...
- IOS 第三方管理库管理 CocoaPods
CocoaPod集成Tips http://www.jianshu.com/p/dcde0668eee9 import导入类失败 http://www.360doc.com/content/15/03 ...
- Person Re-identification 系列论文笔记(八):SPReID
Human Semantic Parsing for Person Re-identification Kalayeh M M, Basaran E, Gokmen M, et al. Human S ...
- Inno Setup 设置开机启动
案1: 将快捷方式添加到“启动”文件夹 [Tasks] Name: "startupicon"; Description: "{cm:CreateQuickLaunchI ...
- UVA_10300:Ecological Premium
Sample Input 351 1 12 2 23 3 32 3 48 9 239 1 86 12 18 1 1310 30 409 8 5100 1000 70Sample Output 3886 ...
- ADO.NET_02
一.说明 这个例子是小白跟着学习代码记录,模拟用户登陆功能,并可以查询所有学生信息. 二.代码 共4个文件,如下 App.config <?xml version="1.0" ...