第十届蓝桥杯——外卖店优先级(CN练习记录)
#include<iostream>
#include<vector>
using namespace std;
struct DD
{
int slot;
int store;
}d1[100001];
int main()
{
int N, M=0, T,i=1,ans=0;
cin >> N >> M >> T;
vector<vector<int>>co(N + 1, vector<int>(T + 1, 0));
vector<int>yxj(N+1,0);
int js = M;
do
{
cin >> d1[i].slot >> d1[i].store;
co[d1[i].store][d1[i].slot]++;
} while (--js);
for (int i = 1; i <=T; i++)
{
for (int j = 1; j <= N; j++)
{
if (co[j][i])
{
yxj[j] += 2 * co[j][i];
}
else
{
if (yxj[j]>0)
{
yxj[j]--;
}
}
}
}
for (int i = 1; i <= N; i++)
{
if (yxj[i]>5)
{
ans++;
}
}
cout << ans;
return 0;
}