제출 #657836

#제출 시각아이디문제언어결과실행 시간메모리
657836cristi_a앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" void encode(int n, int v[]) { for(int i=0; i<n; i++) { int temp = i + (v[i]<<4); send(temp); } }
#include <bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" void decode(int n, int cnt, int v[]) { vector<int> ans(n); for(int i=0; i<cnt; i++) { int pos = (v[i] & ((1<<4)-1)); int nr = (v[i]>>4); ans[pos] = nr; } for(int i=0; i<n; i++) output(ans[i]); }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> ans(n);
      |     ^~~~~~
decoder.cpp:5:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from decoder.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from decoder.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
decoder.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> ans(n);
      |            ^~~
decoder.cpp:9:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |         ans[pos] = nr;
      |         ^~~
      |         abs
decoder.cpp:11:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     for(int i=0; i<n; i++) output(ans[i]);
      |                                   ^~~
      |                                   abs