제출 #250579

#제출 시각아이디문제언어결과실행 시간메모리
250579DanerZeinCombo (IOI18_combo)C++14
97 / 100
40 ms620 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string s = ""; std::string l = ""; if(press("AB")>0){ if(press("A")==1){ s+="A"; l="BXY"; } else{ s+="B"; l="AXY"; } } else{ if(press("X")==1){ s+="X"; l="ABY"; } else{ s+="Y"; l="ABX"; } } if(N==1) return s; while(s.length()<N-1){ int b=press(s+l[0]+l[0]+s+l[0]+l[1]+s+l[0]+l[2]+s+l[1]),le=s.length(); if(b==2+le){ s+=l[0]; } if(b==1+le){ s+=l[1]; } if(b==le){ s+=l[2]; } } if(press(s+"A")>s.length()){ s+="A"; } else{ if(press(s+"B")>s.length()){ s+="B"; } else{ if(press(s+"X")>s.length()){ s+="X"; } else s+="Y"; } } /*if(press(s+"A")>s.length()){ s+="A"; } else{ if(press(s+"B")>s.length()){ s+="B"; } else{ if(press(s+"X")>s.length()){ s+="X"; } else s+="Y"; } }*/ return s; }

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

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