제출 #1038520

#제출 시각아이디문제언어결과실행 시간메모리
1038520vjudge1콤보 (IOI18_combo)C++17
5 / 100
0 ms344 KiB
#include "combo.h"
using namespace std;
std::string guess_sequence(int N) {
  string str,buton;
  if(press("AB"))
    if(press("A"))
      str="A",buton="BXY";
    else str="B",buton="AXY";
  else if(press("X"))
      str="X",buton="ABY";
    else str="Y",buton="ABX";
  for(int i=2;i<N;i++){
    int k=press(str+buton[0]+str+buton[1]+buton[0]+str+buton[1]+buton[1]+str+buton[1]+buton[2]);
    if(k==str.size())str+=buton[2];
    else if(k<str.size()+2)
      str+=buton[0];
    else str+=buton[1];
  };
  if(press(str+buton[0])==N)
    str+=buton[0];
  else if(press(str+buton[1])==N)
    str+=buton[1];
  else str+=buton[2];
  return str;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if(k==str.size())str+=buton[2];
      |        ~^~~~~~~~~~~~
combo.cpp:15:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     else if(k<str.size()+2)
      |             ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...