codeforce 380(div.2)】的更多相关文章

A B 略 C:二分,贪心 设d(i, v)为 剩余油量为v时,车开距离i 所需要的最小时间,使用线性规划不难算出: if v < i return INF; //无法到达 if v > 2*i return i; if i <= v <= 2*i return LL(3)*i - v; 那么一辆车开到终点的最短时间等于 ∑d(g[i]-g[i-1], v)这样只需要二分能开到终点的最小油量,取其中价格最低的即是答案代码如下: 1 #include <cstdio> 2…
A. 题意:给你一串字符串(<=100),将ogo ogogo ogogogo ogogogogo……这种全部缩成***,输出缩后的字符串 分析:第一遍扫对于那些go的位置,记录下next[i]表示最远能扩展到的位置,第二遍扫只要看o即可,如果o后面的位置next存在,那么说明这一段全部缩为***,跳到next[i+1]+1继续下一段操作 B.= = C. 题意:你将从0点开车到s点,路上有一些加油站,加油时间忽略不计.你有两种开车选择,一种是每km走1min,花费2L油,另一种是每km走2mi…
http://codeforces.com/contest/737 A: 题目大意: 有n辆车,每辆车有一个价钱ci和油箱容量vi.在x轴上,起点为0,终点为s,中途有k个加油站,坐标分别是pi,到每个加油站都可以加满油. 每辆车有2种模式,加速模式花1分钟和2个单位的油前进1个单位,正常模式花2分钟和1个单位的油前进1个单位.  要求选一辆最便宜的车,使得开这辆车从起点到终点的时间小于等于t.从起点出发的时候油是满的. n,k<=105.  vi,pi,s<=109 思路: 首先由于每次都可…
A. Road to Cinema 很明显满足二分性质的题目. 题意:某人在起点处,到终点的距离为s. 汽车租赁公司提供n中车型,每种车型有属性ci(租车费用),vi(油箱容量). 车子有两种前进方式 :①. 慢速:1km消耗1L汽油,花费2分钟. ②.快速:1km消耗2L汽油,花费1分钟. 路上有k个加油站,加油不需要花费时间,且直接给油箱加满. 问在t分钟内到达终点的最小花费是多少?(租车子的费用)  若无法到达终点,输出-1 不谈二分的写法.. 我们考虑离散化可修改的点  和限制的点位置…
B. Spotlights 题意 有n×m个格子的矩形舞台,每个格子里面可以安排一个演员或聚光灯,聚光灯仅可照射一个方向(俯视,上下左右).若聚光灯能照到演员,则称为"good position",求:共有多少"good position"(同一格子的不同照射方向算作不同的position). 思路 对于一行而言,只要分别找到两侧第一个演员的位置(命名"标志位"),就能确定这一行的"good position".两标志位以外的…
第一次全程参加的CF比赛(虽然过了D题之后就开始干别的去了),人生第一次codeforces上分--(或许之前的比赛如果都参加全程也不会那么惨吧),终于回到了specialist的行列,感动~.虽然最后也只过了A.B.D3题,但能上分还是非常的激动不已呀. 先发出来A.B.D的参考解法,C比赛时读了题感觉自己可以做出来,但时间只剩20分钟了,索性弃疗--. 11.23 补充上了C的参考代码 A题: 题目地址 用一些str函数应该也可以做,但考虑到字符串长度只有不到100以及题目整体不是很复杂,不…
C time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set u…
E. Subordinates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships con…
C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t m…