제출 #95594

#제출 시각아이디문제언어결과실행 시간메모리
95594tqbfjotld콤보 (IOI18_combo)C++14
30 / 100
64 ms428 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; }

컴파일 시 표준 에러 (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...