제출 #311043

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

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:2: error: expected '}' before 'else'
   18 |  else if(press("A")==1){
      |  ^~~~
combo.cpp:9:20: note: to match this '{'
    9 |  if(press("XY")>=1){
      |                    ^