Submission #477818

#TimeUsernameProblemLanguageResultExecution timeMemory
477818chungdinhCombo (IOI18_combo)C++14
10 / 100
71 ms476 KiB
#include "combo.h" char lst[4] = {'A', 'B', 'X', 'Y'}; std::string guess_sequence(int N) { std::string res = ""; int first; for (int i = 0; i < 4; i++) { if (press(res + lst[i]) == 1) { first = i; res = res + lst[i]; break; } } for (int i = 0; i < N - 1; i++) { for (int j = 0; j < 4; j++) { if (j == first) continue; if (press(res + lst[j]) == res.size() + 1) { res = res + lst[j]; break; } } } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if (press(res + lst[j]) == res.size() + 1) {
      |                 ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:20:13: warning: 'first' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |             if (j == first) continue;
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...