Submission #885791

#TimeUsernameProblemLanguageResultExecution timeMemory
885791sq00Combo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string buttons = "", firstBtn = ""; if(press("A") == 1) { firstBtn = "A"; buttons = "BYX"; } else if(press("B") == 1) { firstBtn = "B"; buttons = "AYX"; } else if(press("Y") == 1) { firstBtn = "Y"; buttons = "ABX"; } else if(press("X") == 1) { firstBtn = "X"; buttons = "ABY"; } string current = firstBtn; while(true) { for(int i = 0; i < (int)buttons.size() - 1; i++) { string test = current + buttons[i]; int cost = press(test); if(cost == test.size()) { current = test; break; } if(i == 1) current += buttons[2]; } if(current.size() == N) break; } return current; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if(cost == test.size()) {
      |                ~~~~~^~~~~~~~~~~~~~
combo.cpp:35:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |         if(current.size() == N) break;
      |            ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...