CF720A Closing ceremony 贪心】的更多相关文章

正解:贪心 解题报告: 传送门! 先考虑如果只有一列怎么搞?那就肯定是尽量走到最远的地方 然后用点儿类似的思想,现在考虑有两列的情况QAQ 为了方便表述,这里给每个位置两个值,a表示离一号入口的距离,b表示离二号入口的距离 可以先把从一号入口进去的安排了,所以考虑按体力从小往大考虑,然后在能满足a的情况下尽量选b比较大的位置 然后再处理二号入口的,就按体力从大往小考虑一下就好 具体实现的话就先把所有坐标按a排序,然后满足的就加入堆,堆的内部按b排序就好 over #include<bits/st…
题面 解析 首先贪心地想一想, 一个人我们肯定让她坐得尽量远, 那到底坐到哪里呢? 考虑先让下面的人先坐, 那他们就要尽量把离上面入口远的位置坐掉, 因此把位置按离上面的距离从大到小排序, 再一个个看能否被下面的人坐到. 并且肯定是让刚刚好能坐到这个位置的人坐最好(lower_bound一下). 最后把剩下的位置与上面的人一一判断即可. code: #include <iostream> #include <cstdio> #include <cstring> #inc…
A. Closing ceremony time limit per test 2 seconds memory limit per test 256 megabytes The closing ceremony of Squanch Code Cup is held in the big hall with n × m seats, arranged in n rows, m seats in a row. Each seat has two coordinates (x, y) (1 ≤ x…
Description The closing ceremony of Squanch Code Cup is held in the big hall with n × m seats, arranged in n rows, m seats in a row. Each seat has two coordinates (x, y) (1 ≤ x ≤ n, 1 ≤ y ≤ m). There are two queues of people waiting to enter the hall…
考试考到自闭,每天被吊打. 还有几天可能就要AFO了呢... Luogu3602:Koishi Loves Segments 从左向右,每次删除右端点最大的即可. [HEOI2014]南园满地堆轻絮 答案一定是 \(\lceil \frac{max_{1\le i < j \le n}(a_i-a_j)}{2} \rceil\). 可以考虑一个二分答案 \(mid\),那么每个数 \(x\) 都是一个 \([x-mid,x+mid]\) 的范围. 当前面有一个 \(y\) 使得 \(y-mid>…
Jingze is a big figure in California State University for his stubbornness. Because of his new failure in the last CET-4, he has decided not to solve problems with English discription any more. In yesterday‘s warm-up contest,he protested to the organ…
A.codeforces1038A You are given a string ss of length nn, which consists only of the first kk letters of the Latin alphabet. All letters in string ss are uppercase. A subsequence of string ss is a string that can be derived from ss by deleting some o…
小故事: A * "1+1+1+1+1+1+1+1 =?" * A : "上面等式的值是多少" B : *计算* "8!" A *在上面等式的左边写上 "1+" * A : "此时等式的值为多少" B : *quickly* "9!" A : "你怎么这么快就知道答案了" A : "只要在8的基础上加1就行了" A : "所以你不用重新计…
题目传送门 /* 题意:有一堆砖块,每一次操作可以选择消去任意一行,也可以选择消去任意一列.求要消去所有的砖块需要最小的操作数 贪心:首先清楚的是消去最高列的最佳,消去第一行最佳,行列的顺序只对中间过程影响,和结果无关 首先sort降序,选择消去列的个数,更新最小值 当时想复杂了,貌似是上学期校赛留下的阴影:) 详细解释:http://blog.csdn.net/liao_jingyi/article/details/40455311 */ #include <cstdio> #include…
Problem E: Opening Ceremony Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 137  Solved: 30[Submit][Status][Web Board] Description Input Output Sample Input 6 2 1 8 8 2 3 Sample Output 5 HINT 题意:有一堆砖块,每一次操作可以选择消去任意一行,也可以选择消去任意一列.求要消去所有的砖块需要最小的操作数. 思路:…