Submission #978972

#TimeUsernameProblemLanguageResultExecution timeMemory
978972rshohruhPermutation (APIO22_perm)C++17
91.33 / 100
2 ms600 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; #define ll long long std::vector<int> construct_permutation(long long k) { k--; vector<int> a; int cur = 0; while((1ll<<a.size())-1 <= k) a.push_back(cur++); a.pop_back(); --cur; k -= (1ll<<a.size())-1; int i = a.size()-1; for(int i = a.size()-1; i >= 0; --i){ if((1ll<<i) <= k){ a.insert(a.begin()+i, cur++); k -= (1ll<<i); } } return a; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:14:6: warning: unused variable 'i' [-Wunused-variable]
   14 |  int i = a.size()-1;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...