# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982982 | Jawad_Akbar_JJ | Permutation (APIO22_perm) | C++17 | 4 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 <iostream>
#include <vector>
using namespace std;
const int N = 100 + 10;
vector<int> construct_permutation(long long k){
vector<int> ans;
long long o = 1;
for (int i=60;i>=0;i--){
if ((o<<i) & k){
for (int j=1;j<=i;j++)
ans.push_back(j * 1000);
while (i > 0){
i--;
if ((o<<i) & k)
ans.push_back(ans[i] - 500);
}
break;
}
}
int n = ans.size(),cur = 0;
vector<int> seen(n,0);
while (cur < n){
int ind = 0;
for (int i=0;i<n;i++)
if (!seen[i] and (seen[ind] or ans[i] < ans[ind]))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |