题目链接:http://codeforces.com/gym/101149/my 题目大意:给你n个人,他们有成绩a,b,c.一个人如果两门课比另外一个人高,那么这个人就比那个人厉害.问,是否存在一个人,他的成绩是垫底的?不存在就输出0.(这里保证所有人的成绩abc都是不相同的) 思路:这题目现在,垫底的只有一个人,所以答案只有0和1.然后,我就躺了...不会...23333. 然后看了别人的代码,sort一次就够了,果然是我智障TAT //看看会不会爆int!数组会不会少了一维! //取物问题…
http://codeforces.com/gym/101149/problem/F 题目要输出最丑陋的衣服.所以每件衣服都要和其他衣服比一次. 但是注意到,能赢一件衣服的衣服,就算是好衣服了. 那么,可以选1做起始点,然后向后比较,如果后面的能赢比较点,那么这件就是好衣服了. 如果不能,那么证明起始点那件衣服是好衣服.当前这件衣服不确定,所以就重新选这件衣服做起吃点,去比较. 有可能会1赢7,7赢8但是8赢2这样,就是说可能要往前比较一次. 所以把数组写两次就可以了. #include <cs…
https://www.luogu.org/problemnew/show/P1073 C国有 n n个大城市和 mm 条道路,每条道路连接这 nn个城市中的某两个城市.任意两个城市之间最多只有一条道路直接相连.这 mm 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为 1条. C C国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一种商品在不同城市的价格不一定相同.但是,同一种商品在同一个城市的买入价和卖出价始终是相同的. 商人阿龙来到 CC 国旅…
F. The Pool for Lucky Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/F Description A new swimming pool has been built in Kazan for the forthcoming Water Sports World Championship. The pool has N lanes. Some…
F. Doomsday Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/F Description Doomsday comes in t units of time. In anticipation of such a significant event n people prepared m vaults in which, as they think, it will…
F. FloodTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/F Description We all know that King Triton doesn't like us and therefore shipwrecks, hurricanes and tsunami do happen. But being bored with the same routine…
F. The Pool for Lucky Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/F Description A new swimming pool has been built in Kazan for the forthcoming Water Sports World Championship. The pool has N lanes. Some…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
题目大意:一个未知的整数序列,给出其任意一个区间和的正负,还原这个序列.任意一个满足条件的序列即可. 题目分析:将连续区间和转化为前缀和之差,sumx-1与sumy的大小关系已知,以此建立一条有向边,做拓扑排序.根据sum0=0,可以构造出所有的前缀和,再取两前缀和之差便得答案. 代码如下: # include<iostream> # include<cstdio> # include<queue> # include<vector> # include&l…