Submission #786549

#TimeUsernameProblemLanguageResultExecution timeMemory
786549JoenPoenManCombo (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; vector<char> chars = {'X', 'Y', 'A', 'B'}; string Sol; std::string guess_sequence(int N) { if (press("AB") >= 1) Sol = (press("A") ? "A" : "B"); else Sol = (press("X") ? "X" : "Y"); chars.erase(find(chars.begin(), chars.end(), Sol[0])); for (int i = 1; i < N-1; i++) { string inp; inp += Sol + chars[0]; inp += Sol + chars[1] + chars[0]; inp += Sol + chars[1] + chars[1]; inp += Sol + chars[1] + chars[2]; int res = press(inp); if (res == Sol.length()) Sol.push_back(chars[2]); else if (res == Sol.length()+1) Sol.push_back(chars[0]); else Sol.push_back(chars[1]); } string inp; inp = Sol + chars[0] + Sol + chars[1]; if (press(inp) == Sol.length()) Sol.push_back(chars[2]); else { inp = Sol + chars[0]; if (press(inp) == Sol.length()) Sol.push_back(chars[1]); else Sol.push_back(chars[0]); } return Sol; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         if (res == Sol.length()) Sol.push_back(chars[2]);
      |             ~~~~^~~~~~~~~~~~~~~
combo.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         else if (res == Sol.length()+1) Sol.push_back(chars[0]);
      |                  ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if (press(inp) == Sol.length()) Sol.push_back(chars[2]);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:34:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         if (press(inp) == Sol.length()) Sol.push_back(chars[1]);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...