제출 #760592

#제출 시각아이디문제언어결과실행 시간메모리
760592coding_snorlax순열 (APIO22_perm)C++17
10 / 100
5 ms596 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; //Main function split it to #(2^k-1) vector<int> split(long long int k){ vector<int> ans; while(k){ //cout << k << " "; int a = (int)log2(k+1); ans.push_back(a); k -= (long long int) pow(2,a)-1; } return ans; } vector<int> construct_permutation(long long int k) { k-=1; vector<int> process = split(k); int Count = 0; for(int i:process){ Count+=i; } vector<int> s; for(int i:process){ for(int j=Count-i;j<Count;j++){ s.push_back(j); } Count-=i; } return s; } /* int main(){ //vector<int> answer = construct_permutation(3); //for(int i:answer) cout << i << " "; vector<int> answer = construct_permutation(1000);//split((long long int)1024*1024*1024*1024*1024*1024-1); for(int i:answer) cout << i << " "; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...