Submission #650228

#TimeUsernameProblemLanguageResultExecution timeMemory
650228truc12a2cvpPermutation (APIO22_perm)C++17
91.33 / 100
2 ms344 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> II; const int N = 1e5 + 5, logN = 20; const int MOD = 1e9 + 7; const ll INF = 1e9; vector<int> construct_permutation(ll k){ vector<int> ans; int m = 0; for(int i = 59; i >= 0; i --){ if(k >> i & 1){ m = i; break; } } for(int i = 0; i < m; i ++) ans.push_back(i); int cur = m - 1; for(int i = m - 1; i >= 0; i --){ if(k >> i & 1){ ans.insert(ans.begin() + i, ++ cur); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...