Submission #1105382

#TimeUsernameProblemLanguageResultExecution timeMemory
1105382lkaterisCombo (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: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 = "";
      |                 ^~