Submission #368197

#TimeUsernameProblemLanguageResultExecution timeMemory
368197OzyCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define lli long long int #define debug(a) cout << #a << " = " << a << endl string res,p; lli a; char arr[4]; void llena(lli tam) { rep(i,1,tam) p += res[i]; res += arr[1]+ arr[1]; rep(i,1,tam) p += res[i]; res += arr[1]+ arr[2]; rep(i,1,tam) p += res[i]; res += arr[1]+ arr[3]; rep(i,1,tam) p += res[i]; res += arr[2]; } string guess_sequence(int N) { a = press("AB"); if (a > 0){ a = press("A"); if (a == 1) res = "A"; else res = "B"; } else { a = press("X"); if (a == 1) res = "X"; else res = "Y"; } if (res == "A") arr = {' ','B','X','Y'}; else if (res == "B") arr = {' ','A','X','Y'}; else if (res == "X") arr = {' ','A','B','Y'}; else arr = {' ','A','B','X'}; rep(i,2,n-1) { p = ""; llena(i-1); a = press(p); if (a > i) res += arr[1]; else if (a == i) res += arr[2]; else res += arr[3]; } p = res; p += arr[1]; a = press(p); if (a == n) { res += arr[1]; return res; } else { p = res; p += arr[2]; if (a == n) { res += arr[2]; return res; } else { res += arr[3]; return res; } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:25: error: assigning to an array from an initializer list
   41 |     if (res == "A") arr = {' ','B','X','Y'};
      |                     ~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:42:30: error: assigning to an array from an initializer list
   42 |     else if (res == "B") arr = {' ','A','X','Y'};
      |                          ~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:43:30: error: assigning to an array from an initializer list
   43 |     else if (res == "X") arr = {' ','A','B','Y'};
      |                          ~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:44:14: error: assigning to an array from an initializer list
   44 |     else arr = {' ','A','B','X'};
      |          ~~~~^~~~~~~~~~~~~~~~~~~
combo.cpp:46:13: error: 'n' was not declared in this scope
   46 |     rep(i,2,n-1) {
      |             ^
combo.cpp:4:44: note: in definition of macro 'rep'
    4 | #define rep(i,a,b) for (int i = (a); i <= (b); i++)
      |                                            ^
combo.cpp:60:14: error: 'n' was not declared in this scope
   60 |     if (a == n) {
      |              ^