Submission #742496

#TimeUsernameProblemLanguageResultExecution timeMemory
742496keisuke6Permutation (APIO22_perm)C++17
0 / 100
1 ms212 KiB
#include "perm.h" #include <vector> #include <iostream> #include <set> using namespace std; vector<int> construct_permutation(long long k) { vector<int> A = {}; int now = 300; int ans = 1; while(ans*2 <= k){ A.push_back(now); ans *= 2; now++; } set<int> B; int n = A.size(); for(int i=0;i<n;i++){ if((1ll<<(n-i-1))+ans <= k) B.insert(i); } vector<int> Ans = {}; now = 100; for(int i=0;i<n;i++){ Ans.push_back(A[i]); if(B.count(i)) Ans.push_back(now); now--; } return Ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...