# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086804 | Timosh | Permutation (APIO22_perm) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |