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 ...
随机推荐
- 【JZOJ3601】【广州市选2014】Tree(tree)
╰( ̄▽ ̄)╭ 每个非叶子节点,其左右子树叶子节点的权值之和相等.我们称这种二叉树叫平衡二叉树. 我们将一棵平衡二叉树叶子节点的权值从左到右列出来,假如这个权值序列是另一个序列A的子序列,我们称这棵平 ...
- Android——兼容性
两种类型的兼容性:设备兼容性和应用兼容性. 设备的Android兼容性就是app能够正确运行的Android执行环境(Android execution environment).Android执行环 ...
- Mybatis使用 爬坑记录
1.mapper.xml可以直接 使用map集合, parameterType="java.util.Map" resultType="java.util.Map&quo ...
- PHP的生成图片或文字水印的类
ImageWatermark.php <?php /*********************************************************** 类名:ImageWat ...
- GNU的__builtin_popcount函数
用来计算32位的unsigned int中的1的个数, 其内部实现是根据查表法来计算的.
- Intersection of Two Linked Lists两链表找重合节点
Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...
- 搭建OA项目环境及卸载指南
一.项目介绍 1).JDK是什么? 全称:Java Development Kit 中文名:java开发工具包 作用:提供java项目的运行环境 JDK安装 a.jdk.jre 安装 ...
- [linux]jenkins迁移 标签: linux服务器 2016-08-28 21:29 988人阅读 评论(20)
我们的测试的jenkins和开发的jenkins 是分开的两个jenkins,然后测试的jenkins很久没有用,我们打算把主节点搬到另外一条服务器上面,然后出了一系列的问题,如下: 一.安装jenk ...
- spider csdn blog part II
继续上次的笔记, 继续完善csdn博文的提取. 发现了非常好的模块. html2docx 结果展示: 运行之后, 直接生成docx文档. 截个图如下: 结果已经基本满意了!!! 在编写过程中的一些感想 ...
- UVa 679 【思维题】
UVA 679 紫书P148例题. 题目大意:小球从一棵所有叶子深度相同的二叉树的顶点开始向下落,树开始所有节点都为0.若小球落到节点为0的则往左落,否则向右落.并且小球会改变它经过的节点,0变1,1 ...