CodeForces 749D Leaving Auction】的更多相关文章

D. Leaving Auction time limit per test: 2 seconds memory limit per test:256 megabytes input:standard input output:standard output There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's…
题目链接:http://codeforces.com/problemset/problem/749/D 题意:就是类似竞拍,然后报价肯定要比上一个高,然后查询输入k个数表示那些人的竞拍无效, 输出最后谁竞拍到了花了多少钱. 比较简单的二分只要找到删除无效人后最大的两个人然后用第二大的那个人的最大竞拍价二分查找 最大的那个人中的竞拍价,然后的得到的第一个大于等于的值即可. #include <iostream> #include <cstring> #include <algo…
二分查找,$set$. 对于某一次询问,如果把人删光了,那么输出$0$ $0$. 如果只剩下$1$个人,那么输出那个人喊的最低价格. 如果剩下的人数有大于等于两个, 这时最底下出现的情景必然是红色部分由一个人喊,紫色部分由另一个人喊. 这两个人分别是喊价最高价次高者和最高者,并且红色部分最后一个位置的下一个位置就是答案.因此只需在获取两个人的信息后,在最高者喊价序列中二分即可. #include<cstdio> #include<cstring> #include<vecto…
Leaving Auction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not…
CodeForces 749D. Leaving Auction 传送门 There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bid…
Leaving Auction 题目链接:http://codeforces.com/contest/749/problem/D 二分 本来以为是哪种神奇的数据结构,没想到sort+lower_bonud就解决了,妙. 这道题的精髓在于将每个人出价的最大值记录下来,最后竞拍到的一定为没有leave的人中出价最高的那个人(因为It's guaranteed that the sum of k over all question won't exceed 200 000. 所以这个操作的总复杂度不会…
http://codeforces.com/contest/749/problem/D 题意:有几个人在拍卖场竞价,一共有n次喊价,有q个询问,每一个询问有一个num,接下来num个人从这次拍卖中除去,问对于每一个询问减掉num个人后是谁赢了拍卖,最小的价格是多少. 思路:昨晚不会做.想法好神奇(我太弱).对于每个人用 set-S 装起来其每次喊价的下标,然后用一个数组order按价格从大到小的顺序将每个人装起来,对于每一个询问,把这num个人丢到一个 set-s 里面,然后在order里面找没…
[题目链接]:http://codeforces.com/problemset/problem/749/D [题意] 有n个人在竞价; 按照时间的顺序给出n次竞价(可能有一些人没有参加竞价); 每次竞价以竞价人的编号和竞价给出; 保证竞价严格递增; 且同一个人不会连续竞价两次; 现在,假设去掉某一些竞价的人; 问你最后谁是那个竞价成功的人? 如果去掉一些人之后,出现了某人连续竞价两次; 则取最小的价格(但要使得他依然能竞价成功); 每次输出winner和它的最小竞价; [题解] 每个人的有用信息…
大意: 若干个人参加拍卖会, 给定每个人出价顺序, 保证价格递增, q个询问, 给出k个人的编号, 求删除这k个人的所有出价后, 最终谁赢, 他最少出价多少. set维护每个人最后一次投票的时间, 每次询问直接暴力找到最后一个未删除的, 假设为$x$, 那么$x$就是最后赢家, 求最少出价的话, 只要$x$的出价大于$x$之前一位的最大出价即可. #include <iostream> #include <sstream> #include <algorithm> #i…
题目:http://codeforces.com/problemset/problem/749/D 题目大意: 有n个人竞拍,也有n个叫牌,一个人可以有多个叫价牌,但也可能有一些人根本不叫价 每个叫牌由叫价人的下标和价码,后叫的价码一定比前面的高,而且不会有人连续出两次价(即不与自己竞价) 可能会有一些人离场,如果下标为1的人离场了,那么他参与的叫价均作废. 如果因离场致使出现某人连续竞价的情况,那么,按此人连续竞价最早的价码计算. 问,在有人离场的情况下,输出那个人以什么样的价码赢得拍卖,均离…
题目连接:Leaving the Bar 题意:给你n个向量,你可以加这个向量或减这个向量,使得这些向量之和的长度小于1.5e6. 题解: 按照正常的贪心方法,最后的结果有可能大于1.5e6 .这里我们可以加一些随机性,多次贪心,直到结果满足题意.正解是每三个向量中都能找到两个向量合起来 <= 1e6,然后不断合并,最后只会剩下一个或者两个向量,如果一个向量肯定 <= 1e6, 如果是两个向量一定 <= 1.5 * 1e6.这是我第一遇到随机化的题~~~ #include<bits…
题目链接: http://codeforces.com/problemset/problem/749/D 题目大意: 一场拍卖会,共n个买家.这些买家共出价n次,有的买家可能一次都没有出价.每次出价用(ai,bi)表示,ai为此次出价人的编号,bi为价格.出价严格递增(bi<bi+1)并且没有玩家在一轮竞拍中在没有其他竞争对手的情况下自动增加自己的出价(ai!=ai+1).现在给定q次查询,每次去掉一些出价者及其所有出价,问最后谁是赢家并且他以什么价格赢得拍卖品. 解题思路: 首先预处理所有的出…
http://codeforces.com/contest/749/problem/D 现在发现做题要把样例抄下来,然后画一画,这样才容易发现新大陆.嗯,以后做题就这样. 如果排除了被删除了的人,那么,剩下的人中,胜出的,就是剩下出价最高的那个,但是它有可能不需要出价那么高,所以只需要比现在剩下的人中,出价第二高的那个人的出价最大值大就可以了. 所以每次只需要找出两个人,即可. 这题学到了,对一个数组排序,还可以依赖其他数组来排. 比如我用per[i]表示排名第i的那个人的id.如果要按它出价最…
#include<bits/stdc++.h> #define lowbit(x) x&(-x) #define LL long long #define N 200005 #define M 1000005 #define mod 1000000007LL #define inf 0x7ffffffff using namespace std; inline int ra() { ,f=; char ch=getchar(); ; ch=getchar();} +ch-'; ch=g…
  # Name     A Bachgold Problem standard input/output 1 s, 256 MB    x6036 B Parallelogram is Back standard input/output 1 s, 256 MB    x4139 C Voting standard input/output 1 s, 256 MB    x2671 D Leaving Auction standard input/output 2 s, 256 MB    x…
A. Bachgold Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number o…
CF-补题1 1.CodeForces 735C    题意:n个人淘汰赛,两个人可以比赛的条件是:两人打过的场数之差绝对值<2.求冠军最多可以打多少场.  总结:看了题解,转换一下思路.求n个人最多打几场 -> 打x场最少要几个人. 要最少,则f[x]=f[x-1]+f[x-2](即和打了x-1场和x-2场的胜者打).然后对n二分就行. 注:很巧妙,变成fibonacci了. 2.CodeForces 742D   题意:请客可容总量w,每个人量wi.魅力值bi.特殊在有朋友圈,同一朋友圈中…
CodeForces 327A 题意:有n个数,都是0或1,然后必须执行一次操作,翻转一个区间,里面的数0变1,1变0,求最多1的数量 思路:最开始我写的最大字段和,后面好像写搓了,然后我又改成暴力,因为这个范围只有100,写n^3都没事,所以我们第一层枚举左区间,第二层枚举右区间,然后我们第三层记录左边1的数量,中间的0的数量,右边的1的数量即可 #include<cstdio> #include<cstring> #include<cmath> #include&l…
传送门 C. Second price auction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be sho…
D. Phillip and Trains time limit per test: 1 second memory limit per test :256 megabytes input: standard input output :standard output The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is loca…
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/560/B Description Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought…
E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Description Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for one person with following rules: There are…
A. Wizards and Trolleybuses Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/167/problem/A Description In some country live wizards. They love to ride trolleybuses. A city in this country has a trolleybus depot with n trolle…
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560/problem/B Description Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a…
D. Phillip and Trains Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/problem/D Description The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one en…
D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go…
E. Ever-Hungry Krakozyabra time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Recently, a wild Krakozyabra appeared at Jelly Castle. It is, truth to be said, always eager to have something for…
A题: A题题目链接 题目描写叙述: 位运算 TimeLimit:1000MS  MemoryLimit:65536KB 64-bit integer IO format:%I64d Problem Description 已知一个包括 n 个元素的正整数集合S.设 f(S) 为集合S中全部元素的异或(XOR)的结果. 如:S={1,2,3}, 则 f(S) = 0. 给出集合S,你须要计算 将全部f(s)进行异或后的值, 这里 s⊆S. Input 多组測试数据.第一行包括一个整数T(T≤20…
Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or  - 1. To pass th…
D. Lakes in Berland 题目连接: http://codeforces.com/contest/723/problem/D Description The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or water. The map is surrounded by the ocean. Lakes…