Submission #957468

#TimeUsernameProblemLanguageResultExecution timeMemory
957468emad234Permutation (APIO22_perm)C++17
0 / 100
1 ms348 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 = 59;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[id]){ 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...