9 条题解

  • 2
    @ 2023-5-7 18:04:13
    #include <iostream>
    #include <set>
    #include <map>
    using namespace std;
    map <pair<int,int>,bool> existed;
    int height[10001];
    int main()
    {
    	int n,r,i,h;
    	cin>>n>>i>>h>>r;
    	height[1]=h;
    	for(int i=0;i<r;i++)
    	{
    		int x,y;
    		cin>>x>>y;
    		if(x>y)
    		{
    			swap(x,y);
    			// cout<<x<<" "<<y<<endl;
    		}
    		if(!existed[make_pair(x,y)])
    		{
    			existed[make_pair(x,y)] = 1;
    			height[x+1] --;
    			height[y]++;
    		}
    
    	}
    	for(int i=1;i<=n;i++)
    	{
    		height[i] += height[i-1];
    		cout<<height[i]<<endl;
    	}
    	return 0;
    }
    

    信息

    ID
    13
    时间
    1000ms
    内存
    128MiB
    难度
    4
    标签
    递交数
    426
    已通过
    181
    上传者