Submission #498084

#TimeUsernameProblemLanguageResultExecution timeMemory
498084IOI_champion_in_1980Combo (IOI18_combo)C++14
0 / 100
2 ms456 KiB
#include<bits/stdc++.h> using namespace std; int a, b, c, d, e, n, m; string s, t, st; int press(std::string p); string guess_sequence(int n) { //int main() { s="ABXY"; string yok="", p=""; for (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 (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]; cout<<st<<endl; 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 (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:35:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for (a=0; a<yok.length(); a++)
      |            ~^~~~~~~~~~~~~
combo.cpp:9:13: warning: control reaches end of non-void function [-Wreturn-type]
    9 |  string yok="", p="";
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...