제출 #988896

#제출 시각아이디문제언어결과실행 시간메모리
988896lo0ker콤보 (IOI18_combo)C++17
5 / 100
1 ms504 KiB
#include "combo.h"

using namespace std;


string guess_sequence(int N) {
  string prefix = "";
  char o1, o2, o3;
  if(press("A") == 1){
    prefix = "A";
    o1 = 'B';
    o2 = 'X';
    o3 = 'Y';
  }
  else if(press("B") == 1){
    prefix = "B";
    o1 = 'A';
    o2 = 'X';
    o3 = 'Y';
  }
  else if(press("X") == 1){
    prefix = "X";
    o1 = 'A';
    o2 = 'B';
    o3 = 'Y';
  }
  else{
    prefix = "Y";
    o1 = 'A';
    o2 = 'B';
    o3 = 'X';
  }

  while(prefix.size() < N-1){
    int coins = press(prefix + o1 + prefix + o2 + o1 + prefix + o2 + o2 + prefix + o2 + o3);
    if(coins == prefix.size()+1){
      prefix += o1;
    }
    else if(coins == prefix.size()+2){
      prefix += o2;
    }
    else{
      prefix += o3;
    }
  }
  if(press(prefix + o1) == N){
    prefix += o1;
  }
  else if(press(prefix + o2) == N){
    prefix += o2;
  }
  else{
    prefix += o3;
  }
  return prefix;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |   while(prefix.size() < N-1){
      |         ~~~~~~~~~~~~~~^~~~~
combo.cpp:36:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     if(coins == prefix.size()+1){
      |        ~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     else if(coins == prefix.size()+2){
      |             ~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...