제출 #349482

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

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:5: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
    7 |  if(press(string("XY")){
      |     ^~~~~
combo.cpp:7:24: error: expected ';' before '{' token
    7 |  if(press(string("XY")){
      |                        ^
      |                        ;
combo.cpp:10:3: error: expected primary-expression before 'else'
   10 |  }else{
      |   ^~~~
combo.cpp:10:3: error: expected ')' before 'else'
   10 |  }else{
      |   ^~~~
      |   )
combo.cpp:7:4: note: to match this '('
    7 |  if(press(string("XY")){
      |    ^