Submission #1311448

#TimeUsernameProblemLanguageResultExecution timeMemory
1311448nataliaaCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { int x; string s; char c='C'; x = press("A"); if(x==1) c='A'; x = press("X") if(x==1) c = 'X'; x = press("Y") if(x==1) c = 'Y'; if(c=='C') c= 'B'; s+=c; for(int i = 1; i < N-1; i++){ string st[4] = {s, s, s, s}; st[0]+='B'; st[1]+="XX"; st[2]+="XY"; st[3]+="XB"; x = press(st[0]+st[1]+st[2]+st[3]); if(x==i) s+='Y'; if(x==i+1) s+='B'; if(x==i+2) s+='X'; } if(c=='A'){ x = press(s+'B'); if(x==N) s+='B'; else { x = press(s+'X'); if(x==N) s+='X'; else s+='Y'; } } if(c=='B'){ x = press(s+'A'); if(x==N) s+='A'; else { x = press(s+'X'); if(x==N) s+='X'; else s+='Y'; } } if(c=='X'){ x = press(s+'B'); if(x==N) s+='B'; else { x = press(s+'A'); if(x==N) s+='A'; else s+='Y'; } } if(c=='Y'){ x = press(s+'B'); if(x==N) s+='B'; else { x = press(s+'X'); if(x==N) s+='X'; else s+='A'; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:17: error: expected ';' before 'if'
   10 |   x = press("X")
      |                 ^
      |                 ;
   11 |   if(x==1) c = 'X';
      |   ~~             
combo.cpp:12:17: error: expected ';' before 'if'
   12 |   x = press("Y")
      |                 ^
      |                 ;
   13 |   if(x==1) c = 'Y';
      |   ~~