제출 #1091919

#제출 시각아이디문제언어결과실행 시간메모리
1091919BarbarBrick앵무새 (IOI11_parrots)C++14
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { for (int i = 0; i < N; i++) { int message = i << 8 + M[i]; send(M[i]); } }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { vector<int> vec; int mask = (1 << 8) - 1; for (int i = 0; i < L; i++) { int b = X[i]; vec.push_back(b); } sort(vec.begin(), vec.end(), greater<int>()); for (int i = 0; i < L; i++) { output(vec[i] & mask); } }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:8:26: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
    8 |     int message = i << 8 + M[i];
      |                        ~~^~~~~~
encoder.cpp:8:9: warning: unused variable 'message' [-Wunused-variable]
    8 |     int message = i << 8 + M[i];
      |         ^~~~~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> vec;
      |   ^~~~~~
decoder.cpp:6:10: error: expected primary-expression before 'int'
    6 |   vector<int> vec;
      |          ^~~
decoder.cpp:11:5: error: 'vec' was not declared in this scope
   11 |     vec.push_back(b);
      |     ^~~
decoder.cpp:13:8: error: 'vec' was not declared in this scope
   13 |   sort(vec.begin(), vec.end(), greater<int>());
      |        ^~~
decoder.cpp:13:32: error: 'greater' was not declared in this scope
   13 |   sort(vec.begin(), vec.end(), greater<int>());
      |                                ^~~~~~~
decoder.cpp:13:40: error: expected primary-expression before 'int'
   13 |   sort(vec.begin(), vec.end(), greater<int>());
      |                                        ^~~
decoder.cpp:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(vec.begin(), vec.end(), greater<int>());
      |   ^~~~
      |   short