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\):
    1. 相互可达,即属于同一集合。
    2. 区间\(a\)的端点是否被\(b\)集合包含。
  • 满足上面其中一点说明\(a\)可达\(b\),否则不可达。

Codeforces Round #189 (Div. 1 + Div. 2)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. 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 ...

  6. 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 ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. 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 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. python中的True和False

    返回真假时,需要为: return True return False

  2. JavaScript 防抖和节流

    1. 概述 1.1 说明 在项目过程中,经常会遇到一个按钮被多次点击并且多次调用对应处理函数的问题,而往往我们只需去调用一次处理函数即可.有时也会遇到需要在某一规则内有规律的去触发对应的处理函数,所以 ...

  3. 【php】php开发的前期准备

    原文来自:http://www.cnblogs.com/sows/p/6867675.html (博客园的)风马一族 侵犯版本,后果自负 php介绍 什么php? 一种服务器端的 HTML 脚本/编程 ...

  4. MySQL遇到经典例子--(遇到就写)

    1,一般的搜索只会搜索标题,也有特殊的情况,就是标题和内容一起搜索! -- 模糊搜索只是搜索标题 $sql = "select count(*) as sum from publish wh ...

  5. Python比较有用的小语法

    额,这是在Codeforces做题的时候从Virtual judge那儿学的 #ord()内置函数,将单个字符变为int#chr()内置函数,将int变为单个字符# for : else ( 或 wh ...

  6. RabbitMQ默认端口

    4369 (epmd), 25672 (Erlang distribution)5672, 5671 (AMQP 0-9-1 without and with TLS)15672 (if manage ...

  7. day39-Spring 08-Spring的AOP:基于AspectJ的注解

    基于AspectJ的注解的开发要重点掌握. 这些表达式肯定要应用在我们的某些个增强上. 学习AspectJ也是两种形式:一种是XML,一种是注解.AspectJ的增强,就是那些通知的类型.Aspect ...

  8. “获取access_token”接口新增IP白名单保护

  9. hdu2577 dp

    也可以字符串搞.dp思路还是很清晰的.dp[][0]表示未锁定,dp[][1]表示锁定键. #include<stdio.h> #include<string.h> #defi ...

  10. [自考]C++中一些特殊用法 2016-10-16 22:12 318人阅读 评论(30) 收藏

    做了一段时间的C++的试题了,总结一些这段时间经常犯错和需要注意的地方. 一.常用的保留字和符号 const 定义常量或者参数 void 定义空类型变量或空类型指针,或指定函数没有返回值 static ...