Submission #969582

#TimeUsernameProblemLanguageResultExecution timeMemory
969582akacool445kPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; // #define int long long #define ll long long #define ff first #define ss second #define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL) const double inf = 1e18 + 9; const int mxn = 2e5 + 2; const int mod = 1e9 + 7; vector<int> construct_permutation(long long k) { vector<int> v; long long cnt1 = 0; long long cnt2 = 0; long long tmp = k; while(tmp > 1) { if(tmp % 2 == 0) { tmp = tmp / 2; cnt1++; } else { tmp--; } } cnt1--; while(k > 1) { if(k % 2 == 0) { k = k / 2; v.push_back(cnt1); cnt1--; } else { k--; v.push_back(cnt2); cnt2++; } } reverse(v.begin(), v.sort()); return v; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:40:23: error: 'class std::vector<int>' has no member named 'sort'
   40 |  reverse(v.begin(), v.sort());
      |                       ^~~~