URAL-1998 The old Padawan 二分】的更多相关文章

先预处理每一个点往前退几步 就一个trick..要处理这一秒已经超出了要拿完所花的时间 #include <iostream> #include <cstring> #include <string> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <ma…
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1998 题意:有n个石头,每个石头有个重量,每个时间点你能让一个石头飞起来,但有m个时间点,你会分心,使得已经飞起来的石头会有重量之和大于k的石头掉下来,问你最终使的所有石头飞起来的时间. 维护一个前缀和,然后二分就可以了. //STATUS:C++_AC_93MS_1113KB #include <functional> #include <algorithm> #inc…
1196. History Exam Time limit: 1.5 second Memory limit: 64 MB Professor of history decided to simplify the examination process. At the exam, every student should write a list of historic dates she knows (she should write the years only and, of course…
二分H2的位置,判断条件为是否有Hi < 0 #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <cmath> using namespace std; ; int N; double A; int dcmp( double a ) { ; ? - : ; } bool cal( double mid, double &…
During a discussion of problems at the Petrozavodsk Training Camp, Vova and Sasha argued about who of them could in 300 minutes find a pair of equal squares of the maximal size in a matrix of size N × M containing lowercase English letters. Squares c…
http://acm.hust.edu.cn/vjudge/contest/126149#problem/H 给定一条二次函数 f (x) = a * x * x + b * x + c 求一个最小的k,使得f(x) + f(x + 1) + f(x + 2) ..... + f(x + k - 1) 不等于 0 恒成立. 首先把参数统一写成 x + t这样的形式,然后带入去 化简有:a*x*x + (2*a*t+b)*x + a*t*t+b*t+c //现在的t是从0--k-1 列出k个式子,…
Description During a discussion of problems at the Petrozavodsk Training Camp, Vova and Sasha argued about who of them could in 300 minutes find a pair of equal squares of the maximal size in a matrix of size N × M containing lowercase English letter…
1822. Hugo II's War Time limit: 0.5 second Memory limit: 64 MB The glorious King Hugo II has declared a war-a war that is holy, victorious, almost bloodless, but ruinous! Right after declaring the war the king has started summoning the army. He plans…
1153. Supercomputer Time limit: 2.0 secondMemory limit: 64 MB To check the speed of JCN Corporation new supercomputer it was decided to figure out the sum of first N (N < 10600) positive integers. Unfortunately, by the time the calculation was finish…
题意:给n个人,每个人都有3个参数,分别是名字,能做的事(a:statements  b:testdate  a.b都可以:anything),Rank 要求:一个人只能做一个事件,要两个人Rank相差2才能共同做a.b,问最多能做多少个a.b,并输出 做a人的名字  做b人的名字 很明显是二分匹配 稳定婚姻问题. 一开始按照 能做a的人->能做b的人 建图  怎么都过不了案例... 后来发现若是这样建图,对于 1 ab 4 2  a  2 3  b  6 若是这样建图     那么就会有两个匹…