Submission #267139

#TimeUsernameProblemLanguageResultExecution timeMemory
267139jairRSCombo (IOI18_combo)C++17
30 / 100
77 ms2616 KiB
#include <iostream> #include "combo.h" #include <vector> using namespace std; vector<string> buttons = {"A", "B", "X", "Y"}; std::string guess_sequence(int N) { string seq; int in; int test1 = press(buttons[0] + buttons[1]); if (test1) { test1 = press(buttons[0]); if (test1) in = 0; else in = 1; } else { int test2 = press(buttons[2]); if (test2) in = 2; else in = 3; } seq = buttons[in]; buttons.erase(buttons.begin() + in); cerr << seq << '\n'; while (seq.size() != N) { int test = press(seq + buttons[0] + seq + buttons[1]); if (test != seq.size() + 1) seq += buttons[2]; else { test = press(seq + buttons[0] + seq + buttons[2]); if (test != seq.size() + 1) seq += buttons[1]; else seq += buttons[0]; } cerr << seq << '\n'; } return seq; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |  while (seq.size() != N)
      |         ~~~~~~~~~~~^~~~
combo.cpp:38:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   if (test != seq.size() + 1)
      |       ~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:43:13: 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 (test != seq.size() + 1)
      |        ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...