Codeforces Round #185 (Div. 1 + Div. 2)
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)的更多相关文章
- 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 ...
随机推荐
- 【JZOJ4744】【NOIP2016提高A组模拟9.2】同余
题目描述 输入 输出 样例输入 5 2 1 5 2 3 7 1 3 2 1 2 5 3 0 样例输出 2 1 数据范围 解法 题目允许离线,且没有修改操作. 考虑把一个询问拆分成两个形如"a ...
- JasperStudio study..
https://blog.csdn.net/shiyun123zw/article/details/79166448
- Spring中使用DataSourceTransactionManager进行事务管理的xml配置
在一个业务的实现过程中,可能需要多条sql完成对数据库的操作,比如账户登录,需要匹配用户名和密码,然后要增加积分,还要记录登录的ip和时间,这可能需要三个sql语句,这三个语句应当是一个整体,任意一个 ...
- python 正则表达式简介
- python 代码中的类和对象
- 闲鱼Flutter&FaaS云端一体化架构
讲师介绍 国有,闲鱼架构团队负责人.在7月13号落幕的2019年Archsummit峰会上就近一年来闲鱼在Flutter&FaaS一体化项目上的探索和实践进行了分享. 传统Native+Web ...
- MacOS利用Terminal访问远程Linux服务器
常用命令 默认22端口访问 ssh x.x.x.x 指定端口访问 ssh x.x.x.x -p port 指定用户访问(默认是MacOS当前用户) ssh user@x.x.x.x [-p port] ...
- 在oracle中操作数据——使用特点的格式插入日期 sql函数的使用——日期函数
日期函数用于处理date类型的数据,默认情况下的日期格式是dd-mm-yy即12-7月-78 (1)sysdate:该函数返回系统时间 (2)add_months(d,n) (3)last_day(d ...
- Libevent:2设置
Libevent有一些整个进程共享的全局设置.这些设置会影响到整个的库.因此必须在调用Libevent其他函数之前进行设置,否则,LIbevent就会陷入不一致的状态. 一:Libevent中的日志信 ...
- H5+ 重写在线升级版本比较代码
重写h5+在线升级版本比较代码 hello h5+版本在线升级提供了如下的版本比较方法,逻辑比较繁琐,相关判断多余,非常不宜读. 先判断新旧版本有无, 接着分割为数组比较数组项大小,而且还只取了前四项 ...