题解 [CF720A] Closing ceremony】的更多相关文章

题面 解析 首先贪心地想一想, 一个人我们肯定让她坐得尽量远, 那到底坐到哪里呢? 考虑先让下面的人先坐, 那他们就要尽量把离上面入口远的位置坐掉, 因此把位置按离上面的距离从大到小排序, 再一个个看能否被下面的人坐到. 并且肯定是让刚刚好能坐到这个位置的人坐最好(lower_bound一下). 最后把剩下的位置与上面的人一一判断即可. code: #include <iostream> #include <cstdio> #include <cstring> #inc…
正解:贪心 解题报告: 传送门! 先考虑如果只有一列怎么搞?那就肯定是尽量走到最远的地方 然后用点儿类似的思想,现在考虑有两列的情况QAQ 为了方便表述,这里给每个位置两个值,a表示离一号入口的距离,b表示离二号入口的距离 可以先把从一号入口进去的安排了,所以考虑按体力从小往大考虑,然后在能满足a的情况下尽量选b比较大的位置 然后再处理二号入口的,就按体力从大往小考虑一下就好 具体实现的话就先把所有坐标按a排序,然后满足的就加入堆,堆的内部按b排序就好 over #include<bits/st…
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 : "所以你不用重新计…
在很多时候,并查集并不是一个完整的解题方法,而是一种思路. 通过以下题目来体会并查集逆向运用的思想. Description Farmer John and his cows are planning to leave town for a long vacation, and so FJ wants to temporarily close down his farm to save money in the meantime.The farm consists of NN barns con…
题目描述 Farmer John and his cows are planning to leave town for a long vacation, and so FJ wants to temporarily close down his farm to save money in the meantime.The farm consists of NN barns connected with MM bidirectional paths between some pairs of b…