Submission #210469

#TimeUsernameProblemLanguageResultExecution timeMemory
210469bashCombo (IOI18_combo)C++17
100 / 100
41 ms692 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string s; string a="A", b="B", c="X"; if(press("AB")) { if(press("A")) { s="A"; a="Y"; } else { b="Y"; s="B"; } } else { if(press("X")) { c="Y"; s="X"; } else s="Y"; } for(int i=2;i<N;i++) { int k=press(s+a+s+b+a+s+b+b+s+b+c); if(k==i) s+=a; else if(k==i+1) s+=b; else s+=c; } if(N>1) { if(press(s+a)==s.size()+1) return s+a; if(press(s+b)==s.size()+1) return s+b; return s+c; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
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+a)==s.size()+1) return s+a;
      |        ~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(press(s+b)==s.size()+1) return s+b;
      |        ~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...