제출 #238583

#제출 시각아이디문제언어결과실행 시간메모리
238583rahul_a_nCombo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
int guess_sequence(int N){
  string ans;
  if(press("A")>0)
    ans="A";
  else if(press("B")>0)
    ans="B";
  else if(press("X")>0)
    ans="X";
  else
    ans="Y";
  for(int i=1;i<N;i++){
    if(press(ans+"A")>i)
    ans+="A";
  else if(press(ans+"B")>i)
    ans+="B";
  else if(press(ans+"X")>i)
    ans+="X";
  else
    ans+="Y";
  }
  return ans;
}

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

combo.cpp:4:5: error: ambiguating new declaration of 'int guess_sequence(int)'
    4 | int guess_sequence(int N){
      |     ^~~~~~~~~~~~~~
In file included from combo.cpp:2:
combo.h:5:13: note: old declaration 'std::string guess_sequence(int)'
    5 | std::string guess_sequence(int N);
      |             ^~~~~~~~~~~~~~
combo.cpp: In function 'int guess_sequence(int)':
combo.cpp:24:10: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
   24 |   return ans;
      |          ^~~