刚学OI半秒的萌新求助第九个点

P1737 [NOI2016] 旷野大计算

Sharpsmile @ 2022-06-22 15:23:54

RT,整道题改了两天了刚到第九个点,昨天下午开始就卡在第九个点了。。。。自己觉得他没啥问题,有注释,代码应该是有可读性的。。。。吧?


if(tp==9){
        int cnt =0;
        for(int i=1;i<=16;i++){
            cout<<"I\n";cnt++;
            cout<<"C "<<cnt<<" "<<"0.00000000000000000001"<<endl;
            cnt++;
            loc[i]=cnt;
        }
        for(int i=1;i<=16;i++){
            for(int j=i+1;j<=16;j++){
                cout<<"+ "<<loc[i]<<" "<<loc[j]<<endl;cnt++;

                int s=cnt;
                cout<<"- "<<loc[i]<<endl;cnt++;
                cout<<"+ "<<loc[j]<<" "<<cnt<<endl;cnt++;//a[j]-a[i]=T

                cout<<"> "<<cnt<<" "<<150<<endl;cnt++;//T>>150
                cout<<"< "<<cnt-1<<" "<<500<<endl;cnt++;//T<<500
                cout<<"S "<<cnt<<" ";cnt++;//S(T<<500)=P(x) : x<0:0;x>=0:1
                cout<<"< "<<cnt<<" "<<151<<endl;cnt++;//P(x)<<151
                cout<<"+ "<<cnt<<" "<<cnt-3<<endl;cnt++;//P(x)+(x>>150);
                cout<<"S "<<cnt<<endl;cnt++;//Y: x<0:(x>>150)/4+0.5;x>=0:1
                cout<<"C "<<cnt<<" -0.5\n";cnt++;//Y-0.5
                cout<<"< "<<cnt<<" "<<152<<endl;cnt++;//(y-0.5)<<152: x<0:x;x>=0:1<<151
                cout<<"- "<<" "<<cnt-4<<endl;cnt++;//-P(x)<<151 x<0:0;x>=0:-1<<151
                cout<<"+ "<<cnt<<" "<<cnt-1<<endl;cnt++;//((y-0.5)<<152)-P(x)<<151   min(T,0)= x<0:x;x>=0:0;
                cout<<"+ "<<loc[i]<<" "<<cnt<<endl;cnt++;//a[i]+min(a[j]-a[i],0);
                loc[i]=cnt;
                cout<<"- "<<loc[i]<<endl;cnt++;
                cout<<"+ "<<s<<" "<<cnt<<endl;cnt++;
                loc[j]=cnt;
            }
            cout<<"O "<<loc[i]<<endl;cnt++;
        }

by Sharpsmile @ 2022-06-23 10:01:22

找到一个问题,eps应该放在T那里加的。。。。。。但是还是WA了QAQ


by Sharpsmile @ 2022-06-27 20:49:58

现在主要的锅可能出在min(T,0)这里,这段的cnt初值是T,和题解对了一下觉得没啥问题,大佬们能不能帮可怜的蒟蒻康一下(

整块的代码请戳这里(剩下的我觉得是没错啦):这里

cout<<"< "<<cnt<<" "<<150<<endl;cnt++;
                cout<<"S "<<cnt<<" ";cnt++;
                cout<<"< "<<cnt<<" "<<150<<endl;cnt++;
                cout<<"> "<<cnt-3<<" "<<149<<endl;cnt++;
                cout<<"+ "<<cnt<<" "<<cnt-1<<endl;cnt++;
                cout<<"S "<<cnt<<endl;cnt++;
                cout<<"< "<<cnt<<" "<<1<<endl;cnt++;
                cout<<"- "<<cnt-5<<endl;cnt++;
                cout<<"+ "<<cnt<<" "<<cnt-1<<endl;cnt++;
                cout<<"C "<<cnt<<" -1\n";cnt++;
                cout<<"< "<<cnt<<" "<<150<<endl;cnt++;//min(T,0)

|