Submission #889305

#TimeUsernameProblemLanguageResultExecution timeMemory
889305Hugo1729Combo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; // int press(string q){return 1;} string guess_sequence(int N){ string ans; string letters[3]; if (press("AB")>0){ if (press("A")==1) {ans="A";letters[0]="B";letters[1]="X";letters[2]="Y";} else {ans="B";letters[0]="A";letters[1]="X";letters[2]="Y";} } else { else if (press("X")==1) {ans="X";letters[0]="B";letters[1]="A";letters[2]="Y";} else {ans="Y";letters[0]="B";letters[1]="X";letters[2]="A";} } int n=1; if (N==1){ return ans; } else if (N==2){ if(press(ans+letters[0])==2) ans+=letters[0]; else if(press(ans+letters[1])==2) ans+=letters[1]; else ans+=letters[2]; return ans; } else{ while(n<=N-2){ int query = press((ans+letters[0])+(ans+letters[1]+letters[0])+(ans+letters[1]+letters[1])+(ans+letters[1]+letters[2])); if (query==n+1) ans+=letters[0]; else if (query==n+2) ans+=letters[1]; else ans+=letters[2]; n++; } if(press(ans+letters[0])==n+1) ans+=letters[0]; else if(press(ans+letters[1])==n+1) ans+=letters[1]; else ans+=letters[2]; return ans; } } "ABABXBY"

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:3: error: 'else' without a previous 'if'
   15 |   else if (press("X")==1) {ans="X";letters[0]="B";letters[1]="A";letters[2]="Y";}
      |   ^~~~
combo.cpp: At global scope:
combo.cpp:50:1: error: expected unqualified-id before string constant
   50 | "ABABXBY"
      | ^~~~~~~~~