제출 #267130

#제출 시각아이디문제언어결과실행 시간메모리
267130jairRS콤보 (IOI18_combo)C++17
10 / 100
67 ms580 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, first; for (int i = 0; i < 4; i++) { if (press(buttons[i])) { seq = buttons[i]; first = buttons[i]; buttons.erase(buttons.begin() + i); break; } } 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]; } } return seq; }

컴파일 시 표준 에러 (stderr) 메시지

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