Submission #155588

#TimeUsernameProblemLanguageResultExecution timeMemory
155588bukanYohandiCombo (IOI18_combo)C++14
30 / 100
81 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" std::string guess_sequence(int N) { int coins,piv; std::string S = ""; while(S.length()<N){ piv=S.length(); coins=press(S+'A'+S+'B'); if(coins>piv){ coins=press(S+'A'); if(coins>S.length()) S+="A"; else S+="B"; } else { coins=press(S+'X'); if(coins>S.length()) S+="X"; else S+="Y"; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    7 |   while(S.length()<N){
      |         ~~~~~~~~~~^~
combo.cpp:12:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     if(coins>S.length()) S+="A";
      |        ~~~~~^~~~~~~~~~~
combo.cpp:16:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     if(coins>S.length()) S+="X";
      |        ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...