#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=200000;
int tot[maxn],sum[maxn],h[maxn];
int n,k,p;//分别表示客栈的个数,色调的数目和能接受的最低消费的最高值
int ans,now;
int main()
{
memset(tot,0,sizeof(tot));
memset(sum,0,sizeof(sum));
memset(h,0,sizeof(h));
int a,b;
scanf("%d%d%d",&n,&k,&p);
for(int i=1;i<=n;i++)
{
scanf("%d%d",&a,&b);
if(b<=p) now=i;
if(now>=h[a])
{
sum[a]=tot[a];
}
tot[a]++;ans+=sum[a];h[a]=i;
}
printf("%d\n",ans);
return 0;
}
【NOIP】选择客栈
最新推荐文章于 2021-10-05 21:50:56 发布