Submission #380863

#TimeUsernameProblemLanguageResultExecution timeMemory
380863fl0rianCombo (IOI18_combo)C++14
100 / 100
46 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) #define pp(x) press(x) using namespace std; std::string guess_sequence(int N) { char f; if(pp("AB")){ if(pp("A"))f='A'; else f='B'; } else{ if(pp("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:30:9: 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(res==s.size()+1)s+=D[0];
      |      ~~~^~~~~~~~~~~~
combo.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   else if(res==s.size()+2)s+=D[1];
      |           ~~~^~~~~~~~~~~~
combo.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  if(press(s+D[0])==s.size()+1){
      |     ~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  else if(press(s+D[1])==s.size()+1){
      |          ~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...