# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
957681 | pragmatist | Permutation (APIO22_perm) | C++17 | 17 ms | 1884 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;
mt19937 rng(time(NULL));
std::vector<int> construct_permutation(long long k)
{
vector<int> ans;
k--;
int n = 0;
vector<pair<int, int> > v;
while(k>0) {
int j = -1;
int mx = 0;
for(int i = 60; i >= 1; --i) {
long long cur = (1ll<<i)-1;
if(cur <= k) {
if(cur == k) {
j = i;
break;
}
int cnt = __builtin_popcountll(k-cur);
if(cnt>mx) {
mx = cnt;
j = i;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |