제출 #250577

#제출 시각아이디문제언어결과실행 시간메모리
250577DanerZein콤보 (IOI18_combo)C++14
97 / 100
39 ms540 KiB
#include "combo.h" using namespace std; std::string guess_sequence(int N) { std::string s = ""; string le=""; if(press("AB")>0){ if(press("A")==1){ s+="A"; le="BXY"; } else{ s+="B"; le="AXY"; } } else{ if(press("X")==1){ s+="X"; le="ABY"; } else{ s+="Y"; le="ABX"; } } if(N==1){ return s; } while(s.size()<N-1){ int sb=press(s+le[0]+le[1]+s+le[0]+le[2]+s+le[0]+le[0]+s+le[1]),mb=s.size(); if(sb==2+mb){ s+=le[0]; } if(sb==1+mb){ s+=le[1]; } if(sb==mb){ s+=le[2]; } } if(press(s+'A')>=s.size()+1){ s+="A"; } else{ if(press(s+"B")>=s.size()+1){ s+="B"; } else{ if(press(s+"X")>=s.size()+1){ s+="X"; } else{ s+="Y"; } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |   while(s.size()<N-1){
      |         ~~~~~~~~^~~~
combo.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   if(press(s+'A')>=s.size()+1){
      |      ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:45:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     if(press(s+"B")>=s.size()+1){
      |        ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |       if(press(s+"X")>=s.size()+1){
      |          ~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...