제출 #957600

#제출 시각아이디문제언어결과실행 시간메모리
957600vjudge1순열 (APIO22_perm)C++17
71.22 / 100
10 ms1328 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { vector<int> ans; k--; int n = 0; vector<pair<int, int> > v; while(k>0) { for(int i = 60; i >= 0; --i) { long long cur = (1ll<<i)-1; if(cur <= k) { n += i; v.push_back({n-i, n-1}); k -= cur; break; } } } reverse(v.begin(), v.end()); for(auto e : v) { int l = e.first; int r = e.second; for(int i = l; i <= r; ++i) { ans.push_back(i); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...