Submission #228775

#TimeUsernameProblemLanguageResultExecution timeMemory
228775two_sidesCombo (IOI18_combo)C++17
100 / 100
40 ms580 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ string res; vector <char> c = {'A', 'B', 'X', 'Y'}; if (press("AB") >= 1) res = press("A") ? "A" : "B"; else res = press("X") ? "X" : "Y"; c.erase(find(c.begin(), c.end(), res[0])); while (int(size(res)) <= n - 2){ int que = press(res + c[0] + res + c[1] + c[0] + res + c[1] + c[1] + res + c[1] + c[2]); if (que == size(res)) res.push_back(c[2]); if (que == size(res) + 1) res.push_back(c[0]); if (que == size(res) + 2) res.push_back(c[1]); } if (int(size(res)) < n){ if (press(res + c[0]) == n) res.push_back(c[0]); else if (press(res + c[1]) == n) res.push_back(c[1]); else res.push_back(c[2]); } return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     if (que == size(res)) res.push_back(c[2]);
      |         ~~~~^~~~~~~~~~~~
combo.cpp:13:13: 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 (que == size(res) + 1) res.push_back(c[0]);
      |         ~~~~^~~~~~~~~~~~~~~~
combo.cpp:14:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if (que == size(res) + 2) res.push_back(c[1]);
      |         ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...