A. Whose sentence is it?

  • 模拟。

B. Archer

  • \[pro=\frac{a}{b}+(1-\frac{a}{b})(1-\frac{c}{d})\frac{a}{b}+(1-\frac{a}{b})^2(1-\frac{c}{d})^2\frac{a}{b}+…\]
  • 本质就是无穷级数求和。

C. The Closest Pair

  • 因为根据\(x\)坐标差值优化,那么只要构造\(x\)坐标都一样的即可。

D. Cats Transport

  • 假设一人在时间T出发,则所有满足\(T+D[h_i]\ge t_i\)的猫都会被带走,所以按\(t_i-D[h_i]\)排序,就可以用\(dp\)做。
  • \(dp(i,j)\)表示前\(i\)只猫\(j\)个人的最小代价。
  • 写出转移方程后,发现可以用斜率优化做。

E. Fetch the Treasure

  • 问题主要在于如何确定一个格子是否可达。我们可以将格子按\(pos\ \%\ k\)分组,对于一个组\(g\)来说,我们只要确定\(min\{pos,pos\ \%\ k =g\}\),那么大于等于最小值的点都是可达的,由于\(k\le 10^4\),所以使用\(dijkstra\)求最小值即可。

F. Interval Cubing

  • 根据Fermat's Little Theorem,\(x^{p-1}=1(mod\ p)\)。
  • 对一个数\(x\)操作\(k\)次后,\(x'=x^{3^k\ mod \ (p-1)}(mod\ p)\)。
  • 因为\(3^{48}\ mod\ 95542720 = 1\),所以循环节为48。那么对于每个数维护48个值即可。

G. Biologist

  • 总收益为\(\sum{w_i}\),考虑总收益扣除最小代价,将问题转化为最小割问题。
  • 根据狗的性别划分成二部图。源点\(S\)连接性别为1的狗,容量为\(v_i\),汇点\(T\)连性别为0的狗。
  • 若人的需求是0,则与源点\(S\)连接代价为\(w_i+isfriend*g\)的边,跟狗都连\(INF\)的边。若需求是1,则与汇点\(T\)连接代价为\(w_i+isfriend*g\)的边,狗同上。

Codeforces Round #185 (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. Apple Watch和Apple Pay将助苹果成为首家市值万亿美元公司

    苹果公司周二盘中市值首次突破7000亿美元,成为标普中首家市值超过7000亿美元的公司,市值是第二名Exxon的1.7倍.有分析师预测苹果在明年的市值将会逼近8000亿美元,不过如果参考著名激进投资人 ...

  2. Sum Root to Leaf Numbers深度优先计算路径和

    Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...

  3. SSM+Maven+IDEA增删改查

    开发工具 IntelliJ IDEA Apache-tomcat-9.0 JDK 1.8 MySQL 8.0.11 Maven 3.5.4 IDEA+Maven搭建项目骨架 1. 新建Maven项目: ...

  4. day39-Spring 06-Spring的AOP:带有切点的切面

    环绕增强功能是最强的,它相当于前置增强和后置增强. 这就是带有切点的切面 package cn.itcast.spring3.demo4; import org.aopalliance.interce ...

  5. day40-Spring 01-上次课内容回顾

  6. js cookies 的写入、读取、删除

    //写cookies //escape() 函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串.function setCookie(name,value) {     var Days ...

  7. JavaScript--tab栏切换效果

    tab栏切换效果: <!DOCTYPE html> <html> <head lang="en"> <meta charset=" ...

  8. c++ 对象池的创建

    template <class T> class ObjectPool { public: using DeleterType = std::function<void(T*)> ...

  9. Mysql Command

    数据库备份: mysqldump -uroot -p -h 192.168.1.190 --default-character-set=utf8 $dbname > backup_db.sql ...

  10. 前端基础☞CSS

    css的四种引入方式 1.行内式 行内式是在标记的style属性中设定CSS样式.这种方式没有体现出CSS的优势,不推荐使用. <p style="background-color: ...