Submission #498091

#TimeUsernameProblemLanguageResultExecution timeMemory
498091IOI_champion_in_1980Combo (IOI18_combo)C++14
0 / 100
2 ms456 KiB
#include<bits/stdc++.h> using namespace std; int press(std::string p); string guess_sequence(int n) { //int main() { string s="ABXY"; string yok, p; for (int a=0; a<3; a++) { string k; k=k+s[a]; if (press(k)==1) { p=p+s[a]; break; } else { yok=yok+s[a]; } } if (p.length()==0) p=p+s[3]; else yok=yok+s[3]; for (int a=2; a<=n-1; a++) { string st=p+yok[0]+yok[0]+p+yok[0]+yok[1]+p+yok[0]+yok[2]+p+yok[1]; int k=press(st); if (k==2) p=p+yok[0]; else if (k==1) p=p+yok[1]; else p=p+yok[2]; } for (int a=0; a<yok.length(); a++) { string st=p; st=st+yok[a]; if (press(st)==n) { return p; // cout<<p<<endl; // break; } } // return p; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for (int a=0; a<yok.length(); a++)
      |                ~^~~~~~~~~~~~~
combo.cpp:6:11: warning: control reaches end of non-void function [-Wreturn-type]
    6 |  string s="ABXY";
      |           ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...