Submission #662819

#TimeUsernameProblemLanguageResultExecution timeMemory
662819AlmaCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" void exploreCave(int N) { memset(S, 0, sizeof S); memset(D, -1, sizeof D); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (D[j] != -1) { A[j] = S[D[j]]; } else { A[j] = 1; } } int ret = tryCombination(A); int target; if (ret == i) { target = 0; } else { target = 1; } int lo = 0, mid, res = -1, hi = N-1; while (lo <= hi) { mid = (lo+hi) / 2; for (int j = 0; j < N; j++) { if (D[j] != -1) continue; if (j < mid) { A[j] = target; } else { A[j] = 1 - target; } } ret = tryCombination(A); if (ret == i) { lo = mid+1; } else { res = mid; hi = mid-1; } } S[i] = target; D[i] = res; } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:4:12: error: 'S' was not declared in this scope
    4 |     memset(S, 0, sizeof S);
      |            ^
cave.cpp:4:5: error: 'memset' was not declared in this scope
    4 |     memset(S, 0, sizeof S);
      |     ^~~~~~
cave.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "cave.h"
  +++ |+#include <cstring>
    2 | 
cave.cpp:5:12: error: 'D' was not declared in this scope
    5 |     memset(D, -1, sizeof D);
      |            ^
cave.cpp:11:17: error: 'A' was not declared in this scope
   11 |                 A[j] = S[D[j]];
      |                 ^
cave.cpp:13:17: error: 'A' was not declared in this scope
   13 |                 A[j] = 1;
      |                 ^
cave.cpp:17:34: error: 'A' was not declared in this scope
   17 |         int ret = tryCombination(A);
      |                                  ^