1 条题解

  • 0
    @ 2024-12-5 12:57:18
    #include <bits/stdc++.h>
    #define LL long long
    using namespace std;
    const int N = 1e4 + 10;
    const int INF = 0x3f3f3f3f;
    int n , m , l , k;
    int cf [N] , a [N];
    bool v [N] [N];
    int sx , sy;
    bool check (int x , int y)
    {
    	if (!v [x] [y])
    	{
    		v [x] [y] = 1;
    		return 1;
    	}
    	return 0;
    }
    int main()
    {
    	    
    		cin >> n >> m >> l >> k;
    	    for (int i = 1; i <= k; i++)
    	    {
    	    	cin >> sx >> sy;
    	    	if (sx > sy)
    	    	{
    	    		swap (sx , sy);
    	    	}
    	    	if (check (sx , sy))
    	    	{
    	    		cf [sx + 1]--;
    	    	    cf [sy]++;
    	    	}	
    	    }
    	    for (int i = 1; i <= n + 1; i++)
    	    	a [i] = a [i - 1] + cf [i];	
    	    for (int i = 1; i <= n; i++)
    		     cout << l + a [i] << "\n";     
    		return 0;
    }
    
    • 1

    信息

    ID
    2474
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    75
    已通过
    31
    上传者