1 solutions

  • 1
    @ 2025-8-14 16:33:34
    #include<bits/stdc++.h>
    using namespace std;
    int n,p,h,m,t[50001],ans[50001];
    bool ds[10001][10001];
    int main(){
    	scanf("%d%d%d%d",&n,&p,&h,&m);
    	int a,b;
    	while(m--){
    		scanf("%d%d",&a,&b);
    		if(a>b)swap(a,b);
    		if(ds[a][b])continue;
    		t[a+1]--;
    		t[b]++;
    		ds[a][b] = true;
    	}
    	for(int i = 1;i<=n;i++){
    		ans[i] = ans[i-1]+t[i];
    		printf("%d\n",h+ans[i]);
    	}
    	return 0;
    }
    

    Information

    ID
    665
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    (None)
    # Submissions
    7
    Accepted
    4
    Uploaded By