Submission #379306

#TimeUsernameProblemLanguageResultExecution timeMemory
379306autumn_eelCombo (IOI18_combo)C++14
5 / 100
2 ms356 KiB
#include "combo.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; std::string guess_sequence(int N) { char f; if(press("AB")){ if(press("A"))f='A'; else f='B'; } else{ if(press("X"))f='X'; else f='Y'; } string C="ABXY",D; for(char c:C){ if(c!=f)D+=c; } string s;s+=f; for(int i=1;i<N-1;i++){ string ask; ask+=s+D[0]; rep(j,3)ask+=s+D[1]+D[j]; int res=press(ask); if(res==s.size()+1)s+=D[0]; else if(res==s.size()+2)s+=D[1]; else s+=D[2]; } if(press(s+D[0])==s.size()+1){ s+=D[0]; } else if(press(s+D[1])==s.size()+1){ s+=D[1]; } else s+=D[2]; cerr<<s<<endl; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   if(res==s.size()+1)s+=D[0];
      |      ~~~^~~~~~~~~~~~
combo.cpp:27:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   else if(res==s.size()+2)s+=D[1];
      |           ~~~^~~~~~~~~~~~
combo.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  if(press(s+D[0])==s.size()+1){
      |     ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  else if(press(s+D[1])==s.size()+1){
      |          ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...