http://www.cplusoj.com/p/1131
没有账号的看这里:
代码:
#include<bits/stdc++.h>
using namespace std;
int n,h,i,r,x,y,sum,a[10007];
int main()
{
cin>>n>>i>>h>>r;
for(int i=0;i<r;i++)
{
cin>>x>>y;
if(x>y) swap(x,y);
a[x+1]+=1,a[y]-=1;
}
for(int i=1;i<=n;i++)
{
sum+=a[i];
cout<<r-sum<<'\n';
}
return 0;
}