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. JRE System Library、Referenced Libraries、Web App Libraries的含义

    JRE System Library.Referenced Libraries.Web App Libraries 这三个都是jar包的存放集合. JRE System Library:指Java S ...

  2. 【51nod1563】坐标轴上的最大团 贪心

    题面 坐标轴上有n个点,每个点有一个权值.第i个点的坐标是 xi ,权值是 wi .现在对这些点建图.对于点对 (i,j) ,如果 \(|xi−xj|≥wi+wj\) ,那么就给第i个点和第j个点之间 ...

  3. iOS 使用Quartz和OpenGL绘图

    http://blog.csdn.net/coder9999/article/details/7641701 第十二章 使用Quartz和OpenGL绘图 有时应用程序需要能够自定义绘图.一个库是Qu ...

  4. qt获取本机ip

    //获取本机IP QString getIP(QString localHost) { QString ipAddr; #if 0 QList<QHostAddress> AddressL ...

  5. buffer的相关小知识

    php与mysql的连接有三种方式,mysql,mysqli,pdo.不管使用哪种方式进行连接,都有使用buffer和不使用buffer的区别. 什么叫使用buffer和不使用buffer呢? 客户端 ...

  6. Objectarx之分批存储相连实体

    void CCommonFuntion::BatchStorageEnt(AcDbObjectIdArray& inputId, std::vector<std::vector<A ...

  7. docker 常用的命令

    1.运行容器 sudo docker run -d -t -p : --name demo ubuntu:16.04 2.删除容器 sudo docker rm -f demo 3.在容器中安装必备软 ...

  8. css技巧:清除浮动

    1.常用方法——overflow 给浮动元素的容器添加overflow:hidden;或overflow:auto;可以清除浮动,另外在 IE6 中还需要触发 hasLayout ,例如为父元素设置容 ...

  9. ADO.NET sqlHelper类(DBHelper类)

    1.配置文件 <connectionStrings> <add name="constr" connectionString="Data Source= ...

  10. 从零学React Native之10Text

    在React Native开发中,所有需要显示的字符串文本都需要放置在Text或者Text的子组件中.虽然在之前的文章中多次使用了Text组件,但是Text组件还是值得专门学习的, 并没有想象中的那么 ...