Submission #988895

#TimeUsernameProblemLanguageResultExecution timeMemory
988895lo0kerCombo (IOI18_combo)C++17
5 / 100
0 ms380 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string prefix = ""; char o1, o2, o3; if(press("A") == 1){ prefix = "A"; o1 = 'B'; o2 = 'X'; o3 = 'Y'; } else if(press("B") == 1){ prefix = "B"; o1 = 'A'; o2 = 'X'; o3 = 'Y'; } else if(press("X") == 1){ prefix = "X"; o1 = 'A'; o2 = 'B'; o3 = 'Y'; } else{ prefix = "Y"; o1 = 'A'; o2 = 'B'; o3 = 'X'; } while(true){ if(prefix.size() == N-1) break; int coins = press(prefix + o1 + prefix + o2 + o1 + prefix + o2 + o2 + prefix + o2 + o3); if(coins == prefix.size()+1){ prefix += o1; } else if(coins == prefix.size()+2){ prefix += o2; } else{ prefix += o3; } } if(press(prefix + o1) == N){ prefix += o1; } else if(press(prefix + o2) == N){ prefix += o2; } else{ prefix += o3; } return prefix; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |     if(prefix.size() == N-1) break;
      |        ~~~~~~~~~~~~~~^~~~~~
combo.cpp:37:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     if(coins == prefix.size()+1){
      |        ~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:40:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     else if(coins == prefix.size()+2){
      |             ~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...