2 solutions

  • 0
    @ 2026-4-4 9:43:14
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	string a;
    	cin>>a;
    	int b=a.size();
    	for(int z=0;z<b;z++)
    	{
    		bool c=0;
    		for(int i=0;i<a.size()-1;i++)
    		{
    			
    			//cout<<a<<"["<<i<<"]="<<a[i]<<" "<<a[i+1]<<"\n";
    			if(a[i]=='(' && a[i+1]==')')
    			{
    				a[i]=32;
    				a[i+1]=32;
    				
    				string b="";
    				for(int j=0;j<a.size();j++)
    				{
    					if(a[j]==')'||a[j]=='(')
    					{
    						b+=a[j];
    					}
    				}
    				a=b;
    				//cout<<a<<"\n";
    				c=1;
    				bool d=1;
    				for(int j=0;j<a.size();j++)
    				{
    					if(a[j]!=32)d=0;
    				}
    				if(d)
    				{
    					cout<<"YES";
    					return 0;
    				}
    			}
    		}
    		if(!c)
    		{
    			cout<<a;
    			cout<<"NO";
    			break;
    		}
    	}
    }
    
    • 0
      @ 2026-4-4 8:19:32
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          cout<<"YES";
      }
      
      • 1

      Information

      ID
      1868
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      7
      Tags
      # Submissions
      18
      Accepted
      10
      Uploaded By