Submission #912363

#TimeUsernameProblemLanguageResultExecution timeMemory
912363huyngoPermutation (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include "perm.h" std::vector<int> construct_permutation(long long k) { std::vector<int> a; long long l = 0, r = 0, dd = 0; auto work = [&](auto self, long long x) -> void { if (x & 1) { a.push_back(--l); dd = l; self(self, x - 1); } else { a.push_back(++r); self(self, x >> 1); } }; for (auto& x : a) x -= (dd - 1); return a; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:7:10: warning: variable 'work' set but not used [-Wunused-but-set-variable]
    7 |     auto work = [&](auto self, long long x) -> void {
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...