题目链接: B. Chip 'n Dale Rescue Rangers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signa…
D. Chip 'n Dale Rescue Rangers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/D Description A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress.…
题目链接: 题目 B. Chip 'n Dale Rescue Rangers time limit per test:1 second memory limit per test:256 megabytes 问题描述 A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they…
B. Chip 'n Dale Rescue Rangers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of d…
这题可以o(1)推出公式,也可以二分答案+验证. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> using namespace std; double X1,X2,Y1,Y2; double v,t; double vx,vy,wx,wy; bool check(double mid) { double tmpx,…
t和可到达具有单调性,二分就不多说了.下面说下O(1)的做法,实际上是等效转换,因为答案一定存在,如果在t0之前,那么分解一下 直接按照只有v计算就可以了.反过来如果计算的结果大于t0,那么表示答案在t0之后.因为速度分量是可以独立累加的,因此 可以找到一开始就只有w的等效的点. #include<bits/stdc++.h> using namespace std; ], y[]; double vm, t0; ], w[]; ; double dex, dey, D; bool uniti…
题意:从一点到另一点,前t秒的风向与t秒后风向不同,问到另一点的最短时间 挺难的,做不出来,又参考了别人的代码.先得到终点指向起点的向量,设T秒钟能到.如果T>t则受风1作用t秒,风2作用T-t秒,否则只受风1作用t秒.风作用对向量的影响加到向量上.如果该向量长度小于(船速*T)^2的话,说明T秒能到.T实际上用low和high的mid得出,如果T秒可行,则提高下限. 乱码: //#pragma comment(linker,"/STACK:1024000000,1024000000&qu…
题目链接:https://codeforces.com/contest/1420/problem/D 前言 之前写过这场比赛的题解,不过感觉这一题还可以再单独拿出来好好捋一下思路. 题意 给出 $n$ 个闭区间,问 $k$ 个区间共区间共有多少种情况. 题解一 以区间为单位进行考虑,排序+优先队列. 将所有区间以左端点为第一关键字,右端点为第二关键字从小到大排序,优先队列中存储不小于当前区间左端点的之前区间的右端点,每个区间对答案的贡献即 $C_{(pque.size(),\ k - 1)}$…
题意:给你\(n\)个区间,从这\(n\)区间中选\(k\)个区间出来,要求这\(k\)个区间都要相交.问共有多少种情况. 题解:如果\(k\)个区间都要相交,最左边的区间和最右边的区间必须要相交,即\(min(r[1],...,r[k])>=max(l[1],...,l[k])\).我们先按左边界对所有区间进行排序,然后遍历左边界,遍历到某个区间时,说明这个区间的左边界目前是最大的,然后我们再判断当前左边界(\(l[i]\)就是最大的)和集合中右边界(\(rs.begin()\),一定是满足条…
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…