제출 #961983

#제출 시각아이디문제언어결과실행 시간메모리
961983shoryu386앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]){ bool bs[N*8]; memset(bs, 0, sizeof(bs)); for (int x = 0; x < N; x++){ for (int z = 0; z < 8; z++){ bs[x*8 + z] = ((M[x] & (1<<z)) != 0); } } for (int x = 0; x < N; x++){ for (int z = 0; z < 8; z++){ if (bs[x*8+z]) send(x*8+z); } } }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]){ bool bs[N*8]; memset(bs, 0, sizeof(bs)); for (int x = 0; x < L; x++){ bs[X[x]] = 1; } int res[N]; memset(res, 0, sizeof(res)); for (int x = 0; x < N; x++){ for (int z = 0; z < 8; z++){ res[x] += bs[z] * (1<<z); } } for (int x = 0; x < N; x++){ output(res[x]); } }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:6:2: error: 'memset' was not declared in this scope
    6 |  memset(bs, 0, sizeof(bs));
      |  ^~~~~~
encoder.cpp:3:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    2 | #include "encoderlib.h"
  +++ |+#include <cstring>
    3 | 

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:6:2: error: 'memset' was not declared in this scope
    6 |  memset(bs, 0, sizeof(bs));
      |  ^~~~~~
decoder.cpp:3:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    2 | #include "decoderlib.h"
  +++ |+#include <cstring>
    3 |