Jizhong a test

2019.07.05 (I burst)

Since freopen lead to operational errors

T0 tracks

About a "pop legitimacy" of the simulation
have been read is confident no problem

while(scanf("%d",&n),n!=0)
    {
        for(int i=1;i<=10;i++)
        {
            memset(a,0,sizeof(a));
            scanf("%d",&a[1]);
            if(a[1]==0) break;
            for(int j=2;j<=n;j++)
            {
               scanf("%d",&a[j]);  
            }
            //if(pd()==true)
            //{
             //     cout<<"Yes"<<endl;
            //}
            //else if(pd()==false)
            //{
            //      cout<<"No"<<endl;
            //}
        }
        cout<<endl;
    }

The result is a TLE. ZX say is a waste of time for the cycle, replaced by this

while(scanf("%d",&n))
    {
        if(n==0) break;
        memset(a,0,sizeof(a));
        while(cin>>a[1],a[1]!=0)
        {
            for(int j=2;j<=n;j++)
            {
               scanf("%d",&a[j]);  
            }
            if(pd()==true)
            {
                cout<<"Yes"<<endl;
            }
            else if(pd()==false)
            {
                cout<<"No"<<endl;
            }
        }
        cout<<endl;
    }

Then is AC mess ~

Independent set T1

This question is I think the longest one
almost the entire exam are thinking:
the beginning, I think it can find out by simulating the recursive, even magic shows the number of sides of each layer, and then in the wrong way the lopsided ??????

In fact, this is the tree-DP,

Guess you like

Origin www.cnblogs.com/HHHG/p/11140465.html