Submission #1111885

#TimeUsernameProblemLanguageResultExecution timeMemory
1111885nikolashamiCombo (IOI18_combo)C++17
0 / 100
1 ms508 KiB
#include<bits/stdc++.h> using namespace std; #include "combo.h" string qs; int q; string guess_sequence(int N){ int n=N; char prvi; qs="ABAB"; q=press(qs); if(!q){ qs="X"; if(press(qs)) prvi='X'; else prvi='Y'; }else{ qs="A"; if(press(qs)) prvi='A'; else prvi='B'; } qs.clear(); qs.push_back(prvi); vector<char>v={'A','B','X','Y'}; v.erase(find(v.begin(),v.end(),prvi)); while(qs.size()<n-1){ string cur=qs; cur+=v[0]; cur+=v[1]; cur+=qs; cur+=v[0]; cur+=v[2]; cur+=qs; cur+=v[0]; cur+=v[0]; cur+=qs; cur+=v[1]; q=press(cur)-qs.size(); if(!q) qs.push_back(v[2]); else if(q==1) qs.push_back(v[1]); else qs.push_back(v[0]); } string tmp=qs; tmp+=v[0]; tmp+=qs; tmp+=v[1]; q=press(tmp); if(q){ tmp.clear(); tmp+=qs; tmp+=v[0]; if(press(tmp)) qs.push_back(v[0]); else qs.push_back(v[1]); }else qs.push_back(v[2]); return qs; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |  while(qs.size()<n-1){
      |        ~~~~~~~~~^~~~
combo.cpp:64:6: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   64 |     }else
      |      ^~~~
combo.cpp:66:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   66 |  return qs;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...