제출 #1141991

#제출 시각아이디문제언어결과실행 시간메모리
1141991ad_oux콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
std::string guess_sequence(int N) {
if (N==3){

std::string p = "";

int doubled{-1};

std::string conseq = "";
std::string S = "";


  if (press("A")==0){conseq+="BXY";}
  else if (press("B")==0){conseq+="AXY";}
  else if (press("X")==0){conseq+="ABY";}
  else if (press("Y")==0){conseq+="ABX";}
  
  for(int i = 0 ; i < 3 ; i++){
  if (press(conseq[i]+conseq[i])==2){doubled = i ;break ;}
  }
  
  if (doubled == -1){
  for(int i = 0 ; i < 3 ; i++){
  if ( press(conseq[i]+conseq[(i+1)%3]+conseq[(i+2)%3])==3){S += conseq[i]+conseq[(i+1)%3]+conseq[(i+2)%3];break ;}
  }
  }
  else {
  for(int i = 0 ; i < 3 ; i++){
  if (i!= doubled && press(conseq[i]+conseq[doubled]+conseq[doubled])==3){S += conseq[i]+conseq[doubled]+conseq[doubled];break ;}
  }
  }
  
  return S;
}

else {
return "HeLLO THERE" ;
}
  
}

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

combo.cpp:1:6: error: 'string' in namespace 'std' does not name a type
    1 | std::string guess_sequence(int N) {
      |      ^~~~~~
combo.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | std::string guess_sequence(int N) {