显示代码纯文本
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define File(x) "tallest."#x
#define For(i,s,e) for(int i=(s); i<=(e); i++)
#define Rep(i,s,e) for(int i=(s); i>=(e); i--)
#define RSON root<<1|1,
using namespace std;
const int N=10000*2+11,M=100;
struct ASK{
int x,y;
bool operator < (const ASK &o) const{
return x==o.x?y<o.y:x<o.x;
}
bool operator == (const ASK &o) const{
return x==o.x && y==o.y;
}
}q[N];
int n,I,H,R,change[N],a,b;
int main()
{
freopen(File(in),"r",stdin);
freopen(File(out),"w",stdout);
// ios::sync_with_stdio(false);
scanf("%d%d%d%d",&n,&I,&H,&R);
/* while(R--){
scanf("%d%d",&a,&b);
if(a>b) swap(a,b);
change[a+1]--,change[b]++;
}*/
For(i,1,R){
scanf("%d%d",&a,&b);
if(a>b) swap(a,b);
q[i]=(ASK){a,b};
}
sort(q+1,q+1+R);
For(i,1,R){
if(q[i]==q[i-1]) continue;
change[q[i].x+1]--,change[q[i].y]++;
}
For(i,1,n){
change[i]+=change[i-1];
printf("%d\n",H+change[i]);
}
return 0;
}