Submission #379307

#TimeUsernameProblemLanguageResultExecution timeMemory
379307autumn_eelCombo (IOI18_combo)C++14
100 / 100
55 ms612 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; if(N==1)return s; 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]; return s; }

Compilation message (stderr)

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