Submission #130174

#TimeUsernameProblemLanguageResultExecution timeMemory
130174rondojimCombo (IOI18_combo)C++17
5 / 100
106 ms1412 KiB
#include "combo.h" #include <string> #include <vector> using namespace std; string guess_sequence(int N) { string moves[4] = {"A","B","X","Y"}; string start; for (int x = 0; x<4; x++){ if (x==3) {start = moves[3]; break;} if (press(moves[x])==1){ start = moves[x]; break; } } vector<string> newmoves; for (int x = 0; x<4; x++){ if (moves[x][0]!=start[0]){ newmoves.push_back(moves[x]); } } for (int x = 1; x<N; x++){ for (int y = 0; y<2; y++){ if (press(start+newmoves[y])==x+1){ start+=newmoves[y]; break; } } if (start.size()<x+1) start+=newmoves[2]; } return start; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         if (start.size()<x+1) start+=newmoves[2];
      |             ~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...