#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
#define debug(x) cerr << #x << "=" << x << endl;
const int MAXN = 1000000 + 10;
int a[MAXN],l=1,r=0,k,n,mians,d[MAXN],sum[MAXN],t[MAXN],dif[MAXN],h;
map<pair<int, int>, bool> book;
void update(int x, int p) {
while(p <= n) {
t[p] += x;
p += p&-p;
}
}
int getsum(int p) {
int sum = 0;
while(p) {
sum += t[p];
p -= p&-p;
}
return sum;
}
int main() {
cin >> n >> l >> h >> r;
for(int i=1; i<=r; i++) {
int a,b;
cin >> a >> b;
if(a > b) swap(a, b);
//左边这样不对 difa+1万一先减后加就成0了 有多次操作呢 if(dif[a+1] && dif[b]) continue;
if(book[make_pair(a,b)]) continue;
book[make_pair(a,b)] = 1;
dif[a+1]--;
dif[b]++;
}
for(int i=1; i<=n; i++) {
sum[i] = sum[i-1] + dif[i];
int nowh = h + sum[i];
cout << nowh << endl;
}
return 0;
}
洛谷P2879 区间统计 - 贪心
最新推荐文章于 2022-08-16 17:10:51 发布