Submission #937078

#TimeUsernameProblemLanguageResultExecution timeMemory
937078Muaath_5Combo (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#ifdef MUAATH_5 #include "ioi.h" #else #include "combo.h" #endif #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string sol = ""; vector<string> p = {"A", "B", "X", "Y"}; if (press("AB")) { if (press("A")) sol += "A"; else sol += "B"; } else { if (press("X")) sol += "X"; else sol += "Y"; } p.erase(find(p.begin(), p.end(), sol)); for (int i = 1; i < n-1; i++) { string ask = ""; for (auto x : p) ask += sol + p[0] + x; ask += sol + p[1]; int res = press(ask); if (res == i + 2) sol += p[0]; else if (res == i + 1) sol += p[1]; else sol += p[2]; } if (press(sol + p[0] + sol + p[1]) == sol.size() + 1) { if (press(sol + p[0]) == sol.size() + 1) sol += p[0]; else sol += p[1]; } else { sol += p[2]; } return sol; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  if (press(sol + p[0] + sol + p[1]) == sol.size() + 1) {
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:43:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   if (press(sol + p[0]) == sol.size() + 1)
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...