제출 #753667

#제출 시각아이디문제언어결과실행 시간메모리
753667vjudge1콤보 (IOI18_combo)C++17
100 / 100
37 ms656 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { string p,c; if(press("AB")) { if(press("A")) p="A",c="BXY"; else p="B",c="AXY"; } else { if(press("X")) p="X",c="ABY"; else p="Y",c="ABX"; } if(N==1) return p; while(p.size()!=N-1) { int coins=press(p+c[0] + p+c[1]+c[0] + p+c[1]+c[1] + p+c[1]+c[2]); if(p.size()+1==coins) p+=c[0]; else if(p.size()+2==coins) p+=c[1]; else p+=c[2]; } if(p.size()!=press(p+c[0])) p+=c[0]; else if(p.size()!=press(p+c[1])) p+=c[1]; else p+=c[2]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  while(p.size()!=N-1) {
      |        ~~~~~~~~^~~~~
combo.cpp:18:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |   if(p.size()+1==coins) p+=c[0];
      |      ~~~~~~~~~~^~~~~~~
combo.cpp:19:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |   else if(p.size()+2==coins) p+=c[1];
      |           ~~~~~~~~~~^~~~~~~
combo.cpp:22:13: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |  if(p.size()!=press(p+c[0])) p+=c[0];
      |     ~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:23:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |  else if(p.size()!=press(p+c[1])) p+=c[1];
      |          ~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...