[Codeforces 496E] Distributing Parts】的更多相关文章

[题目链接] https://codeforces.com/contest/496/problem/E [算法] 按右端点排序 , 每个乐曲优先选取的左端点最大的演奏家 用std :: set维护贪心 时间复杂度 : O(NlogN) [代码] #include<bits/stdc++.h> using namespace std; ; const int inf = 2e9; int n , m; struct info { int l , r , k , home; bool type;…
题意:有n个区间[ai,bi],然后有n个人落在[ci,di],每个人能用ki次.问一种方式站满n个区间. 两种区间都用先x后y的升序排序.对于当前的区间[ai,bi],将ci值小于当前ai的全部放入multiset.再lower_bound查第一个>=bi的就是答案. #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vec…
E. Distributing Parts time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are an assistant director in a new musical play. The play consists of n musical parts, each part must be performed…
Distributing Parts 题目链接:http://codeforces.com/problemset/problem/496/E 贪心 将音乐和人都以低音升序排序,贪心处理低音更低的音乐,找出低音小于等于它的歌手,二分查找高音与它最近的人.因为剩下的人的低音一定小于后面的歌的低音,而我们选择出了满足条件的高音的最小的人,让后面的歌尽有可能的有人唱.然而不知道为什么我用lower_bound(s.begin(),s.end(),modle)会TLE,而用s.lower_bound(mo…
[题目链接]:http://codeforces.com/contest/496/problem/E [题意] 给你n个歌曲; 每个歌曲有一个需要声音的区间li,ri; 然后给你m个人; 每个人也有一个声音区间Li,Ri以及最多能唱的歌曲数目ki; 某个人能唱某首歌当且仅当Li<=li&&ri<=Ri 问你要如何分配这n首歌给哪些人唱 或输出无解; [题解] 把和n+m个区间按照左端点排序; 左端点一样,就把人排在前面; 然后顺序枚举; 对于人,直接把它加入到multiset中…
题目链接:http://codeforces.com/contest/496/problem/E 题意:有n场演出,每场演出都有限制的高音和低音.然后m个人给出每个人的极限高音和低音还有出场次数. 最后问能否将每场演出都安排人,最后输出每场演出的出赛人编号,有多种情况就任意输出. 思路挺简单的就将演出和人都按照低音的从小到大拍好序,然后便利演出.将每场演出能符合条件的人数放入set里 然后二分查找最小高音能符合的. #include <iostream> #include <cstrin…
题目链接:http://codeforces.com/problemset/problem/1006/C (CSDN又改版了,复制粘贴来过来的题目没有排版了,好难看,以后就截图+题目链接了) 题目截图: 题意:一个长度为n的数组,按顺序分成三部分,要求第一部分和第三部分元素的和相等(每一部分都可以没有元素,没有元素的部分元素和为0),求出第一部分和第三部分最大的相等的元素和,如果没有输出0 实现:开两个数组记录下数组的前缀和,后缀和(不知道这样叫对不对),然后用map记录下每个前缀和,后缀和指向…
D. Taxes 题目链接 http://codeforces.com/contest/735/problem/D 题面 Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n ≥ 2) burles and the amount of tax he has to pay is calculated a…
[codeforces 241]C. Mirror Box 试题描述 Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100cm high in this game. Some parts of the box's ceiling and floor are covered by mirrors.…
K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description The world famous scientist Innokentiy almost finished the creation of perpetuum mobile. Its main part is the energy generator which…