Submission #710993

#TimeUsernameProblemLanguageResultExecution timeMemory
710993FoxyyCombo (IOI18_combo)C++17
0 / 100
0 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> char getSingleChar(std::string str) { char ret; if (press(str+"AB") > str.size()) { if (press(str+"A") > str.size()) { ret = 'A'; } else { ret = 'B'; } } else { if (press("X") > str.size()) { ret = 'X'; } else { ret = 'Y'; } } return ret; } std::string guess_sequence(int N) { char first = getSingleChar(""); std::string str = std::string() + first; std::set<char> s{'A', 'B', 'X', 'Y'}; s.erase(first); std::vector<char> cset(s.begin(), s.end()); for (int i = 2; i < N; i++) { int c = press(str + cset[0] + str + cset[1] + cset[0] + str + cset[1] + cset[1] + str + cset[1] + cset[2]); if (c == i) { str += cset[0]; } else if (c == i+1) { str += cset[1]; } else { str += cset[2]; } } char last = getSingleChar(str); return str+last; }

Compilation message (stderr)

combo.cpp: In function 'char getSingleChar(std::string)':
combo.cpp:6:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  if (press(str+"AB") > str.size()) {
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   if (press(str+"A") > str.size()) {
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   if (press("X") > str.size()) {
      |       ~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...