제출 #621464

#제출 시각아이디문제언어결과실행 시간메모리
621464gromperen순열 (APIO22_perm)C++17
71.22 / 100
14 ms1320 KiB
#include "perm.h" #include <bits/stdc++.h> #define ll long long using namespace std; vector<int> construct_permutation(ll k) { k--; vector<int> ans; int mx = 0; while (k > 0) { //cout << "k: " << k << endl; int i = 59; while ((1LL << i) - 1 > k) { i--; } //cout << i << endl; for (int j = mx+i-1; j >= mx; --j) { ans.push_back(j); } mx = mx+i; k-= (1LL << i) - 1; //cout << k << endl; } reverse(ans.begin(), ans.end()); //for (auto i : ans) cout << i << " "; cout << endl; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...