# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580728 | groshi | Nizovi (COI14_nizovi) | C++17 | 193 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
using namespace std;
int main()
{
//cin.tie(0);
//cout.tie(0);
//ios_base::sync_with_stdio(0);
int a,b;
cin>>a>>b;
int pocz_a=1;
int ile_b=b;
for(int i=1;i<=a && ile_b;i++)
{
int pocz=pocz_a+a-i+1;
cout<<"cmp "<<pocz_a<<" "<<pocz<<endl;
int x;
cin>>x;
if(x!=1)
{
pocz_a++;
continue;
}
int kon=a+b,sre,ostd=pocz;
int ile=-pocz;
while(pocz<kon)
{
sre=(pocz+kon+1)/2;
cout<<"cmp "<<sre<<" "<<pocz_a<<endl;
int x;
cin>>x;
if(x!=-1)
kon=sre-1;
else{
pocz=sre;
ostd=sre;
}
}
if(pocz_a<ostd)
{
//cout<<flush;
cout<<"reverse "<<pocz_a<<" "<<ostd<<endl;
}
ile+=ostd;
ile_b-=(ile+1);
if(pocz_a<pocz_a+ile)
{
//cout<<flush;
cout<<"reverse "<<pocz_a<<" "<<pocz_a+ile<<endl;
}
if(pocz_a+ile+1<ostd)
{
//cout<<flush;
cout<<"reverse "<<pocz_a+ile+1<<" "<<ostd<<endl;
}
pocz_a+=ile+2;
}
cout<<"end"<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |