Submission #503733

#TimeUsernameProblemLanguageResultExecution timeMemory
503733sliviuCombo (IOI18_combo)C++14
5 / 100
1 ms328 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = "", left; char first; if (press("AB")) if (press("A")) s += (first = 'A'); else s += (first = 'B'); else if (press("X")) s += (first = 'X'); else s += (first = 'Y'); for (auto x : "ABXY") if (x != first) left += x; for (int i = 2; i <= N - 1; ++i) { string q = s + left[0] + left[0] + s + left[0] + left[1] + s + left[0] + left[2] + s + left[1]; int qry = press(q); if (qry == s.length() + 2) s += left[0]; else if (qry == s.length() + 1) s += left[1]; else s += left[2]; } if (press(s + left[0])==N) s += left[0]; else if (press(s + left[1])==N) s += left[1]; else s += left[2]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:11: 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 (qry == s.length() + 2)
      |       ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   else if (qry == s.length() + 1)
      |            ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...