Submission #542654

#TimeUsernameProblemLanguageResultExecution timeMemory
542654RaresFelixCombo (IOI18_combo)C++17
100 / 100
32 ms576 KiB
#include "combo.h" using namespace std; #include <set> std::string guess_sequence(int N) { string incep_char; if(press("AB")) incep_char = press("A") ? "A" : "B"; else incep_char = press("X") ? "X" : "Y"; string cguess = incep_char; if(N == 1) return incep_char; set<string> Posib{"A", "B", "X", "Y"}; Posib.erase(incep_char); string A, B, C; A = *Posib.begin(); Posib.erase(A); B = *Posib.begin(); Posib.erase(B); C = *Posib.begin(); Posib.erase(C); for(int i = 1; i < N - 1; ++i) { int rasp = press(cguess + A + A + cguess + A + B + cguess + A + C + cguess + B); if(rasp == cguess.size() + 2) cguess += A; else if(rasp == cguess.size() + 1) cguess += B; else cguess += C; } if(press(cguess + A) == N) return cguess + A; if(press(cguess + B) == N) return cguess + B; return cguess + C; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |       if(rasp == cguess.size() + 2) cguess += A;
      |          ~~~~~^~~~~~~~~~~~~~~~~~~~
combo.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |       else if(rasp == cguess.size() + 1) cguess += B;
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...