来警醒一下自己
-=不要写反;
先踢出优先缓存,之后如果有订单的话在+2;
#include<bits/stdc++.h>
using namespace std;
struct shop{
int time=0;int num=0;
};
int sum=0;
shop s[100005];
vector<int> ti[100005];
bool vis[100005]={0};
int main()
{
int n,m,t,time,num;
cin>>n>>m>>t;
for(int i=1;i<=m;i++){
cin>>time>>num;
ti[time].push_back(num);
}
for(int i=1;i<=t;i++){
for(int j=0;j<ti[i].size();j++){
if(ti[i][j]==0)continue;
if(s[ti[i][j]].time<=i-1){
s[ti[i][j]].num-=(i-s[ti[i][j]].time-1);
if(s[ti[i][j]].num<0)s[ti[i][j]].num=0;
}
if(s[ti[i][j]].num<=3)vis[ti[i][j]]=0;
s[ti[i][j]].num+=2;
if(s[ti[i][j]].num>5)vis[ti[i][j]]=1;
s[ti[i][j]].time=i;
}
}
int ans=0;
for(int i=1;i<=n;i++)
{
s[i].num-=(t-s[i].time);
if(s[i].num>5)vis[i]=1;
if(s[i].num<=3)vis[i]=0;
if(vis[i])ans++;
}
cout<<ans;
return 0;
}