Submission #123777

#TimeUsernameProblemLanguageResultExecution timeMemory
123777mlyean00Combo (IOI18_combo)C++14
0 / 100
2 ms280 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string moves = "ABXY"; int N; string s; void get_first() { for (char c : moves) { if (press(string(1, c)) == 1) { s = c; break; } } moves.erase(moves.find(s[0]), 1); } void get_next() { string p = s + moves[0]; for (char c : moves) { p += s; p.push_back(moves[1]); p.push_back(c); } cout << p << endl; switch (press(p) - s.size()) { case 0: s.push_back(moves[2]); break; case 1: s.push_back(moves[0]); break; case 2: s.push_back(moves[1]); break; } } void get_last() { for (char c : moves) { if (press(s + c) > s.size()) { s += c; return; } } } string guess_sequence(int n) { int N = n; get_first(); for (int i = 1; i < N - 1; ++i) get_next(); if (N > 1) get_last(); return s; }

Compilation message (stderr)

combo.cpp: In function 'void get_last()':
combo.cpp:46:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         if (press(s + c) > s.size()) {
      |             ~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...