Submission #217762

#TimeUsernameProblemLanguageResultExecution timeMemory
217762kkm0476Combo (IOI18_combo)C++11
10 / 100
85 ms564 KiB
#include "combo.h" #include <cstdio> #include <iostream> using namespace std; string k[] = {"A", "B", "X", "Y"}; string guess_sequence(int n) { string S; int x; if(press("A") == 1) S = "A", x = 0; else if(press("B") == 1) S = "B", x = 1; else if(press("X") == 1) S = "X", x = 2; else S = "Y", x = 3; while(S.size() < n) { for(int i = 0; i < 4; i++) { if(i == x) continue; if(press(S + k[i]) == S.size() + 1) S += k[i]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(S.size() < n) {
      |           ~~~~~~~~~^~~
combo.cpp:20:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if(press(S + k[i]) == S.size() + 1)
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...