Submission #254922

#TimeUsernameProblemLanguageResultExecution timeMemory
254922niyuCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
using namespace std; #include "combo.h" char c[] = {'A', 'B', 'X', 'Y'}; char s[3]; string ret; string guess_sequence(int N) { if (press("AB")) { if (press("A")) { ret = "A"; s = {"B", "X", "Y"}; } else { ret = "B"; s = {"A", "X", "Y"}; } } else { if (press("X")) { ret = "X"; s = {"A", "B", "Y"}; } else { ret = "Y"; s = {"A", "B", "X"}; } } for (int i = 0; i < N - 2; i++) { ret += s[press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]) - ret.size()]; } if (press(ret + s[0]) == N) return (ret + s[0]); if (press(ret + s[1]) == N) return (ret + s[1]); return (ret + s[2]); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: error: assigning to an array from an initializer list
   12 |       s = {"B", "X", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:16:9: error: assigning to an array from an initializer list
   16 |       s = {"A", "X", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:22:9: error: assigning to an array from an initializer list
   22 |       s = {"A", "B", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:26:9: error: assigning to an array from an initializer list
   26 |       s = {"A", "B", "X"};
      |       ~~^~~~~~~~~~~~~~~~~