# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1130517 | ooscode | Permutation (APIO22_perm) | C++20 | 1 ms | 320 KiB |
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define all(x) x.begin() , x.end()
using namespace std;
vector<int> construct_permutation(int k) {
vector<pair<pair<int , int> , int>> vec;
for(int i = 60 ; ~i ; i--) if((1ll << i) & k) {
if(vec.size()) vec.pb({{i + 1 , 0} , vec.size()});
else
for(int j = 1 ; j <= i ; j++)
vec.pb({{j , 1} , vec.size()});
}
sort(all(vec));
// cout << vec.size() << "\n";
vector<int> ans(vec.size());
for(int i = 0 ; i < vec.size() ; i++)
ans[vec[i].S] = i;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |