首页 > TAG信息列表 > POJ2828

POJ2828 Buy Tickets

考虑如果顺序模拟会T,注意到最后一个元素一定在它确定的位置,考虑从后往前放,找第k个空位,完美解决这题; 1 #include<iostream> 2 #include<cstdio> 3 #define ls (x<<1) 4 #define rs (x<<1|1) 5 using namespace std; 6 const int N=2e5+5; 7 int sum[N<<2],p[N],v[N],ans[N]

POJ2828 Buy Tickets(线段树二分)

题目链接 题目大意   有n个人,依次给出这n个人进入队列时前面有多少人p[i],和它的权值v[i],求最终队列的权值序列。 解题思路   用线段树维护一个数组,最初全是1,代表每个位置有没有人。从后往前推,最后一个人的位置肯定是他最终的位置,然后把他删去,那么消去了最后一个人的影响,倒

poj2828(线段树查找序列第k小的值)

题目链接:https://vjudge.net/problem/POJ-2828 题意:有n个人,依次给出这n个人进入队列时前面有多少人p[i],和它的权值v[i],求最终队列的权值序列。 思路:基本类似于poj2182,简化题意后即为求序列1..n中第k小的值的问题。读入数据量比较大,最好读入优化。我们从n..1逆序遍历,则可以确认最后

POJ2828 Buy Tickets

题意 Language:DefaultBuy Tickets Time Limit: 4000MSMemory Limit: 65536KTotal Submissions: 25813Accepted: 12368DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Y

poj2828

POJ2828 Buy Tickets http://poj.org/problem?id=2828 Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue… The Lunar New Year was approaching, but unluckily the Little Cat still

poj2828--Buy Tickets

题目描述 Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue… The Lunar New Year was approaching, but unluckily the Little Cat still had schedules going here and there. Now, he had to travel