Submission #988892

#TimeUsernameProblemLanguageResultExecution timeMemory
988892lo0kerCombo (IOI18_combo)C++17
5 / 100
1 ms356 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){ 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(prefix.size() == N-1) break; } if(press(prefix + o1) == prefix.size()+1){ prefix += o1; } else if(press(prefix + o2) == prefix.size()+1){ prefix += o2; } else{ prefix += o3; } return prefix; }

Compilation message (stderr)

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