Although the game is not possible to consider the situation, but wrote a few groups can go through, did not think, 23333, a line of code can be a, sorry ~ ~
1#include <cstdio>2#include <iostream>3#include <algorithm>4#include <cstring>5#include <cmath>6#include <queue>7#include <map>8 using namespacestd;9 #defineMOD 1000000007Ten #definePB (a) push_back (a) One Const intinf=0x3f3f3f3f; A Const Doubleeps=1e-5; -typedefLong Longll; - #defineCL (a) memset (A,0,sizeof (a)) the #defineTS printf ("*****\n"); - Const intmaxn=150010; - intn,m,tt,cnt,k; - structNode + { - intID; + Chars[205]; A intv; atFriendBOOL operator<(Node a,node b) - { - if(a.v==B.V) - { - returnA.id>b.id; - } in returna.v<B.V; - } to }NODE[MAXN]; + structNode2 - { the intb,c; * void inch() $ {Panax Notoginsengscanf"%d%d",&b,&c); - } the }NODE2[MAXN]; + intANS[MAXN]; A voidFun () the { + inti; -Priority_queue<node>Q; $ Node now; $ intsum=0, tot=0; - for(i=1; i<=k;i++) - { the Q.push (Node[i]); - if(Q.size () +sum==node2[tot].b)Wuyi { the for(intj=0; J<node2[tot].c&&!q.empty (); j + +) - { Wunow=q.top (); - Q.pop (); Aboutans[sum++]=now.id; $ } -tot++; - } - } A while(!q.empty ()) + { thenow=q.top (); - Q.pop (); $ans[sum++]=now.id; the } the } the BOOLcmp (Node2 aa,node2 BB) the { - returnaa.b<bb.b; in } the intMain () the { About intI,j,ca=1, q; the #ifndef Online_judge theFreopen ("1.in","R", stdin); the #endif +scanf"%d",&TT); - while(tt--) the {Bayiscanf"%d%d%d",&k,&m,&q); the the for(i=1; i<=k;i++) - { -scanf"%s%d",&node[i].s,&node[i].v); theNode[i].id=i; the } thenode2[0].b=-1; the for(i=0; i<m;i++) - { theNode2[i].inch(); the } theSort (node2,node2+m,cmp);94 Fun (); the intQQ; the for(i=0; i<q;i++) the {98scanf"%d",&QQ); Aboutqq--; - if(i==0)101 {102printf"%s", NODE[ANS[QQ]].S);103 Continue;104 } theprintf"%s", NODE[ANS[QQ]].S);106 }107printf"\ n");108 }109 the}
HDU 5441 Priority Queue + simulation * *