Submission #1105376

#TimeUsernameProblemLanguageResultExecution timeMemory
1105376lkaterisCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <string> 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:12:9: error: 'press' was not declared in this scope
   12 |     if (press("AB") > 0) {
      |         ^~~~~
combo.cpp:30:9: error: expected primary-expression before 'else'
   30 |         else {
      |         ^~~~
combo.cpp:29:10: error: expected ')' before 'else'
   29 |         }
      |          ^
      |          )
   30 |         else {
      |         ~~~~
combo.cpp:26:12: note: to match this '('
   26 |         if ((press("X") > 0) {
      |            ^
combo.cpp:40:17: error: 'press' was not declared in this scope
   40 |         int c = press(S + s1 + S + s2 + S + s3 + S + s4);
      |                 ^~~~~
combo.cpp:45:9: error: 'press' was not declared in this scope
   45 |     if (press(S + 'A' + S + 'B') > cnt) {
      |         ^~~~~
combo.cpp:57:35: error: expected ')' before '{' token
   57 |         if ((press(S + "X") > cnt) {
      |            ~                      ^~
      |                                   )
combo.cpp:65:5: error: expected primary-expression before '}' token
   65 |     }
      |     ^
combo.cpp:8:17: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     string s1 = "";
      |                 ^~