Submission #591611

#TimeUsernameProblemLanguageResultExecution timeMemory
591611Morisz10Combo (IOI18_combo)C++14
100 / 100
30 ms608 KiB
#include <iostream> #include <vector> #include <string> #include "combo.h" using namespace std; string guess_sequence(int N) { string chr = "ABXY"; int a = press("AB"); if (a) { a = press("A"); if (!a)swap(chr[0], chr[1]); } else { a = press("X"); if(a) swap(chr[0], chr[2]); else swap(chr[0], chr[3]); } string s = ""; s += chr[0]; while (s.length() < N - 1) { int x = press(s + chr[2] + s + chr[3] + chr[1] + s + chr[3] + chr[2] + s + chr[3] + chr[3]); s += chr[x - s.length() + 1]; } if (N == 1)return s; if (press(s + chr[1]) == N)return s + chr[1]; if (press(s + chr[2]) == N)return s + chr[2]; return s + chr[3]; } /* int main() { } */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |  while (s.length() < N - 1) {
      |         ~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...