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. jquery文字上下滚动--单行 批量多行 文字图片上下翻滚 | 多行滚动

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Linux C/C++开发

    首先就是要熟练在vim里面写代码,其实就是没有提示和自动补全了,这个问题并不大. 我服务器gcc版本是4.8.5,所以就按照这个来了 https://gcc.gnu.org/onlinedocs/gc ...

  3. 【python爬虫】加密代理IP的使用与设置一套session请求头

    1:代理ip请求,存于redis: # 请求ip代理连接,更新redis的代理ip def proxy_redis(): sr = redis.Redis(connection_pool=Pool) ...

  4. MaxCompute 助力衣二三构建智能化运营工具

    摘要:本文由衣二三CTO程异丁为大家讲解了如何基于MaxCompute构建智能化运营工具.衣二三作为亚洲最大的共享时装平台,MaxCompute是如何帮助它解决数据提取速度慢.数据口径差异等问题呢?程 ...

  5. 给大家分享一张CSS选择器优选级图谱 !

  6. spring-cloud-zuul跨域问题解决

    问题发现 正常情况下,跨域是这样的: 1. 微服务配置跨域+zuul不配置=有跨域问题 2. 微服务配置+zuul配置=有跨域问题 3. 微服务不配置+zuul不配置=有跨域问题 4. 微服务不配置+ ...

  7. python socketserver ftp上传功能

    一.socketserver用于多个客户端访问同一个服务端 客户端 import socket client = socket.socket() ip_port = ('127.0.0.1',8001 ...

  8. 王坚十年前的坚持,才有了今天世界顶级大数据计算平台MaxCompute

    如果说十年前,王坚创立阿里云让云计算在国内得到了普及,那么王坚带领团队自主研发的大数据计算平台MaxCompute则推动大数据技术向前跨越了一大步. 数据是企业的核心资产,但十年前阿里巴巴的算力已经无 ...

  9. install jqdatasdk

    install jqdatasdk pip3 install jqdatasdk ... 54% |█████████████████ | 3.2MB 84kB/s eta 0:0 54% |████ ...

  10. HZOJ 导弹袭击

    比较显然的一个性质是如果存在$a(i)>=a(j) \& \& b(i)>=b(j)$那么j没用. 我们并不需要A,B的具体取值,我们之关心$\frac {A}{B}$. ...