http://poj.org/problem?id=2828 Buy Tickets Time Limit: 4000MS Memory Limit: 65536KTotal Submissions: 12307 Accepted: 6080 Description Railway tickets were difficult to buy around the Lunar Ne
Tickets Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 4 Accepted Submission(s) : 2 Font: Times New Roman | Verdana | Georgia Font Size: ←
一开始为空队列,n个人,每次插队在第p个人后面,求最后的位置。 当最后一个人插入时,他的位置与最后的结果中的位置相同,可确定,所以倒着求。 用线段树记录区间内空格数。 #include <iostream> #include <cstdio> using namespace std; const int maxn = 200000 + 5; int se