제출 #957469

#제출 시각아이디문제언어결과실행 시간메모리
957469emad234순열 (APIO22_perm)C++17
91.33 / 100
2 ms436 KiB
#include "perm.h" #include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<int, int> const int mod = 1e9 + 7; const int mxN = 1e4 + 100; using namespace std; std::vector<int> construct_permutation(long long k) { vector<int>ans; bool vis[64] = {}; int n = -1; for(int i = 60;i >= 0;i--){ if((k >> i) % 2){ if(n == -1) n = i; else vis[i] = 1; } } vector<int>v; int id = 0; for(int i = 0;i < n;i++){ if(vis[i]){ v.push_back(id); id++; } ans.push_back(id); id++; } while(v.size()){ ans.push_back(v.back()); v.pop_back(); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...