It's a new week, eh.
8.8
Do CF
After a day's game, B thought well and complicated. Always count SG is wrong.
C is not understand how to deal with the first T-seconds inside not be 2 operation of the number of operations dropped
CF 366 Div2 c C-thor
To each node A queue, the queue is stored in the corresponding to the time it added,
In the 3 operation, you can maintain a position, if the last operation to T1 then this operation will only need to T1 to T2.
I didn't expect to throw every time as a thing into the queue.
1#include <stdio.h>2#include <string.h>3#include <stdlib.h>4#include <time.h>5#include <math.h>6#include <vector>7#include <map>8#include <Set>9#include <stack>Ten#include <queue> One#include <string> A#include <iostream> -#include <algorithm> - using namespacestd; the -typedefLong LongLL; -typedef pair<int,int>PII; -typedef pair<Double,Double>PDD; + Const DoubleEPS = 1e-8; - Const intINF = (1<< -) -1; + Const intMAXN =300010; A intN,M,QUE[MAXN]; atqueue<int>Q[MAXN]; - - voidsolve () { - intOp,x,t =0, ans =0, pos =0; -memset (que,-1,sizeof(que)); - for(inti =1; I <= m;i++){ inscanf"%d%d",&op,&x); - if(OP = =1){ toQUE[++T] =x; + Q[x].push (t); -ans++; the } * Else if(OP = =2){ $ while(!Q[x].empty ()) {Panax Notoginseng intU =Q[x].front (); Q[x].pop (); -Que[u] =-1; theans--; + } A } the Else{ + inttop =min (t,x); - for(inti = pos+1; I <= top;i++){ $ if(Que[i] = =-1)Continue; $ intv =Que[i]; - Q[v].pop (); -ans--; the } -pos =Max (pos,top);Wuyi } theprintf"%d\n", ans); - } Wu } - About intMain () { $scanf"%d%d",&n,&m); - solve (); - return 0; -}
View Code
Week 8.8---8.14