CF#335 Freelancer's Dreams】的更多相关文章

Freelancer's Dreams time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool p…
C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/605/problem/C Description Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool pro…
Freelancer's Dreams 我们把每个二元组看成是平面上的一个点, 那么两个点的线性组合是两点之间的连线, 即x * (a1, b1) + y * (a1, b1) && x + y == 1, 那么n个点的线性组合就是一个凸包, 那么我们求出凸包和(0, 0)到(p, q)直线的交的那个较大值就是最优的组合平均速度. 需要注意的是, 直线和凸包可能没有交点, 需要加入(maxa, 0), (0, maxb)这两个点. #include<bits/stdc++.h>…
题意:p, q,都是整数. sigma(Ai * ki)>= p, sigma(Bi * ki) >= q; ans = sigma(ki).输出ans的最小值 约束条件2个,但是变量k有100000个,所以可以利用对偶性转化为求解 ans = p * y1 + q * y2 约束条件为: Ai * y1 + Bi * y2 <= 1 其中i为0~n-1 也就是n个约束条件. 后面三分搞搞就好了 #include <bits/stdc++.h> using namespace…
 Intergalaxy Trips time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The scientists have recently discovered wormholes — objects in space that allow to travel very long distances between gal…
Board Game time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard output You are playing a board card game. In this game the player has two characteristics, x and y — the white magic skill and the bla…
Lazy Student time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm o…
Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are dist…
题意:给你n个工程,做了每个工程相应增长x经验和y钱.问你最少需要多少天到达制定目标.时间可以是浮点数. 思路:杜教思路,用对偶原理很简易.个人建议还是标准解题法,凸包+线性组合. #include<iostream> #include<string> #include<algorithm> #include<cstdlib> #include<cstdio> #include<set> #include<map> #in…
题目链接:http://codeforces.com/contest/605/problem/A 大意是对一个排列进行排序,每一次操作可以将一个数字从原来位置抽出放到开头或结尾,问最少需要操作多少次可以将原排列变为有序. 一个比较很想当然的算法是用长度减去最长上升子序列,但这是错误的. 反例: 5 1 3 4 5 2 按照n-lis,会得出答案1,但显然这是做不到的,答案应是2 正解应当是考虑最终变为有序时,所有未经操作的数字,应当是连续的.所以要使得操作次数最少就要求在原来数列中位置递增的最长…