Submission #778026

#TimeUsernameProblemLanguageResultExecution timeMemory
778026WarinchaiCombo (IOI18_combo)C++14
100 / 100
26 ms692 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int n){ string s=""; int x=press("AB"); char st; if(x>=1){ int y=press("A"); if(y>=1){ s+='A'; }else{ s+='B'; } }else{ int y=press("X"); if(y>=1){ s+='X'; }else{ s+='Y'; } } st=s[0]; //cout<<"st:"<<st<<endl; vector<char>v; if(s[0]!='A'){ v.push_back('A'); } if(s[0]!='B'){ v.push_back('B'); } if(s[0]!='X'){ v.push_back('X'); } if(s[0]!='Y'){ v.push_back('Y'); } for(int i=2;i<=n-1;i++){ string tmp=""; tmp+=s+v[0]; for(int j=0;j<3;j++){ tmp+=s+v[1]+v[j]; } int c=press(tmp); //cout<<i<<":"<<tmp<<" "<<c<<endl; if(c==i-1){ s+=v[2]; }else if(c==i){ s+=v[0]; }else{ s+=v[1]; } } //cout<<"before last "<<s<<endl; if(n==1){ return s; } string tmp=""; tmp=s+v[0]; int c=press(tmp); if(c==n){ s=tmp; }else{ tmp=s+v[1]; c=press(tmp); if(c==n){ s=tmp; }else{ s=s+v[2]; } } //cout<<s<<endl; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:10: warning: variable 'st' set but not used [-Wunused-but-set-variable]
    7 |     char st;
      |          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...