cave.cpp:6:24: error: expected ',' or '...' before '(' token
6 | int query(int N, int[] (&S))
| ^
cave.cpp: In function 'int query(int, int*)':
cave.cpp:8:28: error: 'S' was not declared in this scope
8 | int x = tryCombination(S);
| ^
cave.cpp: At global scope:
cave.cpp:14:25: error: expected ',' or '...' before '(' token
14 | int flip_switches(int[] (&s), int[] (&assignment), int l, int r, int N)
| ^
cave.cpp: In function 'int flip_switches(int*)':
cave.cpp:17:16: error: 'l' was not declared in this scope
17 | for (int i=l; i<=r; i++)
| ^
cave.cpp:17:22: error: 'r' was not declared in this scope
17 | for (int i=l; i<=r; i++)
| ^
cave.cpp:19:13: error: 'assignment' was not declared in this scope; did you mean 'sigevent'?
19 | if (assignment[i] == -1)
| ^~~~~~~~~~
| sigevent
cave.cpp:22:13: error: 's' was not declared in this scope
22 | s[i] = 1;
| ^
cave.cpp:25:21: error: 'N' was not declared in this scope
25 | int ans = query(N, s);
| ^
cave.cpp:25:24: error: 's' was not declared in this scope
25 | int ans = query(N, s);
| ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:33:8: error: structured binding declaration cannot have type 'int'
33 | int[N] switches;
| ^~~
cave.cpp:33:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
cave.cpp:33:9: error: declaration of 'auto N' shadows a parameter
33 | int[N] switches;
| ^
cave.cpp:31:22: note: 'int N' previously declared here
31 | void exploreCave(int N)
| ~~~~^
cave.cpp:33:12: error: expected initializer before 'switches'
33 | int[N] switches;
| ^~~~~~~~
cave.cpp:33:12: error: expected ';' before 'switches'
cave.cpp:34:8: error: structured binding declaration cannot have type 'int'
34 | int[N] assignment;
| ^~~
cave.cpp:34:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
cave.cpp:34:12: error: expected initializer before 'assignment'
34 | int[N] assignment;
| ^~~~~~~~~~
cave.cpp:37:9: error: 'switches' was not declared in this scope
37 | switches[i] = 0;
| ^~~~~~~~
cave.cpp:38:9: error: 'assignment' was not declared in this scope; did you mean 'sigevent'?
38 | assignment[i] = -1;
| ^~~~~~~~~~
| sigevent
cave.cpp:44:29: error: 'switches' was not declared in this scope
44 | int curr = query(N, switches);
| ^~~~~~~~
cave.cpp:48:41: error: 'assignment' was not declared in this scope; did you mean 'sigevent'?
48 | if (flip_switches(switches, assignment, lo, mid, N) == curr)
| ^~~~~~~~~~
| sigevent
cave.cpp:57:9: error: 'assignment' was not declared in this scope; did you mean 'sigevent'?
57 | assignment[lo] = door;
| ^~~~~~~~~~
| sigevent
cave.cpp:59:12: error: 'switches' was not declared in this scope
59 | answer(switches, assignment);
| ^~~~~~~~
cave.cpp:59:22: error: 'assignment' was not declared in this scope; did you mean 'sigevent'?
59 | answer(switches, assignment);
| ^~~~~~~~~~
| sigevent