제출 #978878

#제출 시각아이디문제언어결과실행 시간메모리
978878Aybak순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include "perm.h" #include <vector> std::vector<int> construct_permutation(long long k) { vector<int> out(k - 1); for (long long i = 0; i < k - 1; ++i) { out[i * -1 + k - 2] = i; } return out; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:5:2: error: 'vector' was not declared in this scope
    5 |  vector<int> out(k - 1);
      |  ^~~~~~
perm.cpp:5:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from perm.h:1,
                 from perm.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 perm.h:1,
                 from perm.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
perm.cpp:5:9: error: expected primary-expression before 'int'
    5 |  vector<int> out(k - 1);
      |         ^~~
perm.cpp:7:3: error: 'out' was not declared in this scope
    7 |   out[i * -1 + k - 2] = i; }
      |   ^~~
perm.cpp:8:9: error: 'out' was not declared in this scope
    8 |  return out; }
      |         ^~~