1 solutions

  • 0
    @ 2025-12-8 16:39:01
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    int main()
    {
    	int n,t;
    	cin>>n>>t;
    	vector<LL> score(n+10);
    	map<LL,int> mp;
    	mp[0]=n;//一共有n个0
    	for(int i=0;i<t;i++)
    	{
    		int a,b;
    		cin>>a>>b;
    		if(--mp[score[a]]==0) mp.erase(score[a]);//移除score[a]
    		score[a]+=b;
    		++mp[score[a]]; //对应分数的数量增加了一个
    		cout<<mp.size()<<endl;
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    2747
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    5
    Accepted
    3
    Uploaded By