// Simple queue simulation <br/> # include <iostream> <br/> # include <queue> <br/> # include <cstring> <br/> # include <algorithm> <br/> using namespace STD; <br/> int priority [101]; <br/> struct job <br/>{< br/> int priority; <br/> bool yours; <br/>} job [101]; <br/> bool CMP (int A, int B) <br/>{< br/> return A> B; <br/>}< br/> int main () <br/> {<br/> // freopen ("in.txt", "r", stdin ); <br/> int t; <br/> scanf ("% d", & T); <br/> while (t --) <br/> {<Br/> int N, P, time = 1, Pt = 0; <br/> memset (job, 0, sizeof (job) * 100 ); <br/> queue <job> q; <br/> scanf ("% d", & N, & P); <br/> job [p]. yours = 1; <br/> for (INT I = 0; I <n; ++ I) <br/> {<br/> scanf ("% d ", & priority [I]); <br/> job [I]. priority = Priority [I]; <br/> q. push (job [I]); <br/>}< br/> sort (priority, priority + N, CMP); <br/> while (Q. front (). priority! = Priority [pt] |! Q. front (). yours) <br/>{< br/> job temp; <br/> temp = Q. front (); <br/> q. pop (); <br/> If (temp. priority = Priority [pt]) <br/>{< br/> PT ++; <br/> ++ time; <br/>}< br/> elseq. push (temp); <br/>}</P> <p> printf ("% d/N", time ); <br/>}< br/> return 0; <br/>}