제출 #934664

#제출 시각아이디문제언어결과실행 시간메모리
934664tamyte앵무새 (IOI11_parrots)C++14
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { int i; for(i=0; i<N; i++) { int now = i + (M[i] << 3); send(now); } }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { int i; std::vector<int> res(N); for(i=0; i<L; i++) { int num = 0; for (int j = (1 << 3); j <= X[i]; j <<= 1) { if (j & X[i]) { num += (j >> 3); } } int idx = 0; for (int j = 0; j < 3; ++j) { if ((1 << j) & X[i]) { idx += (1 << j); } } // std::cout << idx << " " << num << " <- " << X[i] << "\n"; res[idx] = num; } for (int i = 0; i < N; ++i) { output(res[i]); } }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:8: error: 'vector' is not a member of 'std'
    7 |   std::vector<int> res(N);
      |        ^~~~~~
decoder.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    2 | #include "decoderlib.h"
  +++ |+#include <vector>
    3 | 
decoder.cpp:7:15: error: expected primary-expression before 'int'
    7 |   std::vector<int> res(N);
      |               ^~~
decoder.cpp:22:5: error: 'res' was not declared in this scope
   22 |     res[idx] = num;
      |     ^~~
decoder.cpp:25:12: error: 'res' was not declared in this scope
   25 |     output(res[i]);
      |            ^~~