Submission #1105380

#TimeUsernameProblemLanguageResultExecution timeMemory
1105380lkaterisCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <string> #include "combo.h" using namespace std; string guess_sequence(int N) { string S = ""; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; if (press("AB") > 0) { if (press("B") > 0) { S[0] = 'B'; s1 = "XA"; } else { S[0] = 'A'; s1 = "XB"; } s2 = "XY"; s3 = "XX"; s4 = "Y"; } else { if ((press("X") > 0) { S[0] = 'X'; s1 = "AY"; } else { S[0] = 'Y'; s1 = "AX"; } s2 = "AB"; s3 = "AA"; s4 = "B"; } int cnt = 1; for(int i=1;i<N-1;++i) { int c = press(S + s1 + S + s2 + S + s3 + S + s4); if (c - cnt == 2) S += s1[0]; else if (c - cnt == 1) S += s4[0]; cnt++; } if (press(S + 'A' + S + 'B') > cnt) { if (press(S + 'A') > cnt) { S += 'A'; return S; } else { S += 'B'; return S; } } else { if ((press(S + "X") > cnt) { S += 'X'; return S; } else { S += 'Y'; return S; } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:29: error: expected ';' before '{' token
   27 |         if ((press("X") > 0) {
      |                             ^~
      |                             ;
combo.cpp:31:9: error: expected primary-expression before 'else'
   31 |         else {
      |         ^~~~
combo.cpp:30:10: error: expected ')' before 'else'
   30 |         }
      |          ^
      |          )
   31 |         else {
      |         ~~~~
combo.cpp:27:12: note: to match this '('
   27 |         if ((press("X") > 0) {
      |            ^
combo.cpp:58:35: error: expected ')' before '{' token
   58 |         if ((press(S + "X") > cnt) {
      |            ~                      ^~
      |                                   )
combo.cpp:66:5: error: expected primary-expression before '}' token
   66 |     }
      |     ^
combo.cpp:9:17: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     string s1 = "";
      |                 ^~