제출 #742497

#제출 시각아이디문제언어결과실행 시간메모리
742497keisuke6순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include "perm.h" #include <vector> #include <iostream> #include <set> #include <map> using namespace std; vector<int> construct_permutation(long long k) { vector<int> A = {}; int now = 300; int ans = 1; while(ans*2 <= k){ A.push_back(now); ans *= 2; now++; } set<int> B; int n = A.size(); for(int i=0;i<n;i++){ if((1ll<<(n-i-1))+ans <= k) B.insert(i); } vector<int> Ans = {}; now = 100; for(int i=0;i<n;i++){ Ans.push_back(A[i]); if(B.count(i)) Ans.push_back(now); now--; } n = Ans.size(); vector<int> Ansc = Ans; sort(Ans.begin(),Ans.end()); map<int,int> m; for(int i=0;i<n;i++) m[Ans[i]] = i; vector<int> Ans_ = {}; for(int i=0;i<n;i++) Ans.push_back(m[Ansc[i]]); return Ans; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:32:2: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   32 |  sort(Ans.begin(),Ans.end());
      |  ^~~~
      |  qsort