Submission #393932

#TimeUsernameProblemLanguageResultExecution timeMemory
393932GammaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" void exploreCave(int N) { int y, d[N], a[N], s[N]; memset(d, -1, sizeof d); for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { a[j] = 0; } for(int j = 0; j < i; j++) { a[d[j]] = s[d[j]]; } y = tryCombination(a); if(y <= i && y != -1) { int S = 0, e = N - 1, mid; while(S <= e) { mid = (S + e) / 2; for(int j = S; j < mid; j++) { a[j] = 1; } for(int j = 0; j < i; j++) { a[d[j]] = s[d[j]]; } // printf("%d ", a[0]); y = tryCombination(a); // if(i == 3) printf("%d\t", y); if(y <= i && y != -1) { a[mid] = 1; y = tryCombination(a); if(y <= i && y != -1) { S = mid + 1; } else { d[i] = mid; s[mid] = 1; break; } } else { e = mid - 1; for(int j = S; j < mid; j++) { a[j] = 0; } for(int j = 0; j < i; j++) { a[d[j]] = s[d[j]]; } } } } else { int S = 0, e = N - 1, mid; while(S <= e) { mid = (S + e) / 2; memset(a, 0, sizeof(a)); for(int j = S; j < mid; j++) { a[j] = 1; } for(int j = 0; j < i; j++) { a[d[j]] = s[d[j]]; } y = tryCombination(a); if(y <= i && y != -1) { e = mid - 1; for(int j = S; j < mid; j++) { a[j] = 0; } for(int j = 0; j < i; j++) { a[d[j]] = s[d[j]]; } } else { a[mid] = 1; y = tryCombination(a); if(y <= i && y != -1) { d[i] = mid; s[mid] = 0; break; } else { S = mid + 1; } } } } for(int j = 0; j < N; j++) a[d[j]] = j; // printf("\n%d %d\n", a[i], s[d[i]]); } answer(s, a); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:7:5: error: 'memset' was not declared in this scope
    7 |     memset(d, -1, sizeof d);
      |     ^~~~~~
cave.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "cave.h"
  +++ |+#include <cstring>
    2 |