제출 #992836

#제출 시각아이디문제언어결과실행 시간메모리
992836vjudge1Cave (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h" void exploreCave(int n) { int sure[n] = {}, correct[n] = {}, index[n] = {}; for (int i = 0; i < n; i++) { int open = tryCombination(correct) == i; int l = 0, r = n-1; while (l < r) { const int mid = (l+r)/2; int cpy[n]; memcpy(correct, cpy, sizeof c) if (!open) for (int i = mid+1; i < n; i++) if (!sure[i]) cpy[i] = 1; else for (int i = 0; i <= mid; i++) if (!sure[i]) cpy[i] = 1; if (tryCombination(cpy) == i) l = mid+1; else r = mid; } index[l] = i, correct[l] = open, sure[l] = 1; } answer(correct, index); }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:10:41: error: 'c' was not declared in this scope
   10 |             memcpy(correct, cpy, sizeof c)
      |                                         ^
cave.cpp:10:13: error: 'memcpy' was not declared in this scope
   10 |             memcpy(correct, cpy, sizeof c)
      |             ^~~~~~
cave.cpp:2:1: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "cave.h"
  +++ |+#include <cstring>
    2 | void exploreCave(int n) {
cave.cpp:12:39: warning: statement has no effect [-Wunused-value]
   12 |                 for (int i = mid+1; i < n; i++)
      |                                     ~~^~~
cave.cpp:12:47: error: expected ';' before ')' token
   12 |                 for (int i = mid+1; i < n; i++)
      |                                               ^
      |                                               ;
cave.cpp:15:13: error: 'else' without a previous 'if'
   15 |             else
      |             ^~~~