Submission #1046593

#TimeUsernameProblemLanguageResultExecution timeMemory
1046593JerCombo (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { int res; string letters[] = {"A", "B", "Y", "X"}, start, curr; for (auto x : letters) { start = x; if (press(x) == 1) break; } while (curr.size() < n) { for (auto x : letters) { if (x != start) res = press(start + x); if (res > curr.size()) { curr += x; break; } } } return curr; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |   while (curr.size() < n)
      |          ~~~~~~~~~~~~^~~
combo.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |       if (res > curr.size())
      |           ~~~~^~~~~~~~~~~~~
combo.cpp:23:11: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |       if (res > curr.size())
      |           ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...