| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 671081 | AdamGS | Permutation (APIO22_perm) | C++17 | 2 ms | 360 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;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>construct_permutation(ll k) {
vector<int>ans;
if(k==1) return ans;
if(k%3==0) {
ans=construct_permutation(k/3);
rep(i, ans.size()) ans[i]+=2;
reverse(all(ans));
ans.pb(0);
ans.pb(1);
reverse(all(ans));
return ans;
}
if(k%2==1) {
ans=construct_permutation(k-1);
reverse(all(ans));
ans.pb(ans.size());
reverse(all(ans));
return ans;
}
ans=construct_permutation(k/2);
rep(i, ans.size()) ++ans[i];
reverse(all(ans));
ans.pb(0);
reverse(all(ans));
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
