Submission #1086804

#TimeUsernameProblemLanguageResultExecution timeMemory
1086804TimoshPermutation (APIO22_perm)C++17
0 / 100
1 ms348 KiB
#include "bits/stdc++.h" #include "perm.h" using namespace std; std::vector<int> construct_permutation(long long k) { int mx = 10000; int mn = 0; vector<int> cur; long long x = k - 1; while (x > 0) { if (x % 2) { x--; cur.push_back(mx--); } else x /= 2, cur.push_back(mn++); } int subtr = 0; reverse(cur.begin(), cur.end()); for (auto &i : cur) { if (i > 1000) i -= 10000 - (int)cur.size(); } return cur; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:21:6: warning: unused variable 'subtr' [-Wunused-variable]
   21 |  int subtr = 0;
      |      ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...