Submission #580718

#TimeUsernameProblemLanguageResultExecution timeMemory
580718groshiNizovi (COI14_nizovi)C++17
90 / 100
179 ms280 KiB
#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,pocz_b=a+1; for(int i=1;i<=a && pocz_b<=a+b;i++) { int pocz=pocz_a+a-i+1; cout<<"cmp "<<pocz_a<<" "<<pocz<<"\n"; int x; cin>>x; if(x==-1) { pocz_a++; continue; } int kon=a+b,sre,ostd=pocz_b; while(pocz<kon) { sre=(pocz+kon+1)/2; cout<<"cmp "<<pocz_a<<" "<<sre<<"\n"; 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<<"\n"; } int ile=ostd-pocz_b+1; if(pocz_a<pocz_a+ile-1) { //cout<<flush; cout<<"reverse "<<pocz_a<<" "<<pocz_a+ile-1<<"\n"; } if(pocz_a+ile<ostd) { //cout<<flush; cout<<"reverse "<<pocz_a+ile<<" "<<ostd<<"\n"; } pocz_a+=ile+1; pocz_b+=ile; } cout<<"end\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...