Submission #440081

#TimeUsernameProblemLanguageResultExecution timeMemory
440081rainboy자동 인형 (IOI18_doll)C++17
Compilation error
0 ms0 KiB
#include "doll.h" using namespace std; typedef vector<int> vi; #define N 200000 #define N_ (1 << 18) /* N_ = pow2(ceil(log2(N))) */ int tmp[N_ * 2]; void split(int *aa, int n) { int i, j, k; for (i = 0, j = n / 2, k = 0; k < n; k++) tmp[k % 2 == 0 ? i++ : j++] = aa[k]; memcpy(aa, tmp, n * sizeof *tmp); } vi xx, yy; void build(int *aa, int n, int idx) { if (n == 2) xx[idx] = aa[0], yy[idx] = aa[1]; else { split(aa, n); xx[idx] = -(idx * 2 + 1 + 1), yy[idx] = -(idx * 2 + 2 + 1); build(aa, n / 2, idx * 2 + 1), build(aa + n / 2, n / 2, idx * 2 + 2); } } int aa[N_ * 2]; void create_circuit(int m, vi aa_) { vi cc(m + 1); int n = aa_.size(), n_, i; n_ = 1; while (n_ < n + 1) n_ <<= 1; for (i = 0; i < n_ - (n + 1); i++) aa[i] = -1; for (i = 0; i < n; i++) aa[n_ - (n + 1) + i] = aa_[i]; xx.resize(n_ - 1), yy.resize(n_ - 1); build(aa, n_, 0); for (i = 0; i <= m; i++) cc[i] = -1; answer(cc, xx, yy); }

Compilation message (stderr)

doll.cpp: In function 'void split(int*, int)':
doll.cpp:17:2: error: 'memcpy' was not declared in this scope
   17 |  memcpy(aa, tmp, n * sizeof *tmp);
      |  ^~~~~~
doll.cpp:2:1: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "doll.h"
  +++ |+#include <cstring>
    2 |