# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716929 | raysh07 | Permutation (APIO22_perm) | C++17 | 3 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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> ans;
void dowork(int y){
for (int i=0; i<ans.size(); i++){
if (ans[i] >= y){
ans[i]++;
}
}
}
vector<int> construct_permutation(long long k)
{
ans.clear();
int last = -1;
long long fk = k;
for (int i=0; i<62; i++){
if (fk != 0){
if (fk >> i & 1)
fk -= 1LL<<i;
if (fk != 0)
ans.push_back(i);
last = i;
}
}
for (int i=last - 1; i>=0; i--){
if (k >> i & 1){
dowork(i);
ans.push_back(i);
}
}
return ans;
}
// int main(){
// int k; cin>>k;
// vector <int> ok = construct_permutation(k);
// for (auto x: ok) cout<<x<<" ";
// return 0;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |