제출 #982982

#제출 시각아이디문제언어결과실행 시간메모리
982982Jawad_Akbar_JJ순열 (APIO22_perm)C++17
91.33 / 100
4 ms348 KiB
#include <iostream> #include <vector> using namespace std; const int N = 100 + 10; vector<int> construct_permutation(long long k){ vector<int> ans; long long o = 1; for (int i=60;i>=0;i--){ if ((o<<i) & k){ for (int j=1;j<=i;j++) ans.push_back(j * 1000); while (i > 0){ i--; if ((o<<i) & k) ans.push_back(ans[i] - 500); } break; } } int n = ans.size(),cur = 0; vector<int> seen(n,0); while (cur < n){ int ind = 0; for (int i=0;i<n;i++) if (!seen[i] and (seen[ind] or ans[i] < ans[ind])) ind = i; ans[ind] = cur++; seen[ind] = 1; } return ans; } // signed main(){ // long long k; // cin>>k; // vector<int> ans = construct_permutation(k); // for (int i : ans) // cout<<i<<' '; // cout<<'\n'; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...