Submission #988900

#TimeUsernameProblemLanguageResultExecution timeMemory
988900lo0kerCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { if(N == 1){ if(press("A") == 1){ return "A"; } else if(press("B") == 1){ return "B"; } else if(press("X") == 1){ return "X"; } else "Y"; } 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(prefix.size() < N-1){ string q = prefix + o1 + prefix + o2 + o1 + prefix + o2 + o2 + prefix + o2 + o3; if(press(q) == prefix.size()+1){ prefix += o1; } else if(press(q) == 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:17:10: warning: statement has no effect [-Wunused-value]
   17 |     else "Y";
      |          ^~~
combo.cpp:46:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |   while(prefix.size() < N-1){
      |         ~~~~~~~~~~~~~~^~~~~
combo.cpp:48:17: 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(q) == prefix.size()+1){
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:51:22: 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(q) == prefix.size()+2){
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...