1 solutions

  • -1
    @ 2023-3-5 14:03:19
    #include<string.h>
    #include <stdio.h>
    int main()
    {
    	int p[1000005],n,s,e=0,k=0;//e表示当前脑子容量
    	char c;
    	memset(p,0,sizeof(p));
    	scanf("%d",&n);
    	while(n--)
    	{
    		scanf("\n%c %d",&c,&s);
    		if(c=='+')
    		{	
    		    if(--e<0)
    			{
    				e=0;
    				k++;
    			}
    		} 
    		else
    		{
    			if(!p[s])
    				k++;
    			e++; 
    		}
    		p[s]=1;
    	}
    	printf("%d\n",k);
    	return 0;
    }
    

    Information

    ID
    6704
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    (None)
    # Submissions
    44
    Accepted
    6
    Uploaded By