# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
821436 | radaiosm7 | Permutation (APIO22_perm) | C++17 | 10 ms | 1364 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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
--k;
vector<int> groups;
int sum = 0;
vector<int> ans;
long long po[61];
po[0] = 1LL;
for (int i=1; i <= 59; ++i) po[i] = po[i-1]*2LL;
int cc;
for (int i=59; i >= 1; --i) {
cc = 0;
while (k >= po[i]) {
k -= po[i];
++cc;
++k;
}
if (cc == 1) {
groups.push_back(i);
sum += i;
}
else if (cc == 2) {
groups.push_back(i+1);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |