Contest Balloons】的更多相关文章

题目链接:codeforces 725D . Contest Balloons 先按气球数从大到小排序求出初始名次,并把名次排在第一队前面的队放入优先队列,按w-t-1值从小到大优先,然后依次给气球给排名在前面的的队,给完后自己的气球数减少,继续跟之前排在第一队后面的队比较,考虑是否加入队列,每次记录最好的名次. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> us…
Contest Balloons 题目链接:http://codeforces.com/problemset/problem/725/D 贪心+枚举 每次在排名在自己前面的选出w-t值最小的送气球,更新rank即可. (一直觉得cin比scanf不会慢太多,结果我跑出来是2000ms,队友300ms...) 代码如下: #include<iostream> #include<cstdio> #include<algorithm> #include<queue>…
          D. Contest Balloons          time limit per test 3 seconds         memory limit per test 256 megabytes input standard input output standard output One tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We…
http://codeforces.com/contest/725/problem/D 这题一看就是贪心的了,w - t最小的那个,肯定是优先打死. 但是一直都不会写,为什么呢,因为这个太像二分答案了,一看到这题就想到了二分答案,二分排名,二分扔掉气球...... 但是是不行的啊.因为扔掉n个,可能会变优,但是不能保证扔掉更小或者扔掉更多,那个更优呢?(可能需要三分答案?晚上回来试试) 其实这题只需要用优先队列维护. 用两个队列,que保存本来排名就比我高的那些队,优先弹出w - t最小的. 第…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output One tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We assume that the submission time doesn't matter and…
最近好弱做什么题目都是做一晚上 这是合肥站炼铜后遗症? 这题就是贪心 我已开始还写了1小时---三分-----. #include<bits/stdc++.h> using namespace std; #define sz(X) ((int)X.size()) typedef long long ll; const int INF = 0x3f3f3f3f; const int N = 3e5+5; struct Node{ int id; ll t, w; }p[N]; bool cmp1…
题意:acm队伍可以得气球,相同气球数是一个排名.每个队伍有一个气球数上限,如果该队伍的气球数大于上限 该队伍被淘汰.给了你队伍的气球数,你的气球可以给别人,问你最大可能的排名. (2 ≤ n ≤ 300 000) (0 ≤ ti ≤ wi ≤ 10^18) 思路:对每个初始t[i]>t[1]的i,将w[i]-t[i]+1放入小根堆中 开始给气球,将给出气球后大于当前气球数的组的w[i]-t[i]+1继续放入堆中 记录给后名次的最小值即可 ; ..]of int64; n,m,i,ans,t,w…
偏方记录背包里的物品.....每个背包的价值+0.01 Happy Programming Contest Time Limit: 2 Seconds      Memory Limit: 65536 KB In Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the cont…
C. Andryusha and Colored Balloons time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Andryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he…
Happy Programming Contest Time Limit: 2 Seconds      Memory Limit: 65536 KB In Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the contest, the team will get a lov…