# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984132 | vjudge1 | Permutation (APIO22_perm) | C++17 | 377 ms | 1344 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>
#define sz size()
#define ll long long
using namespace std;
mt19937_64 rnd(8181781228);
vector<int> construct_permutation(ll k)
{
ll z = 1, sum = 0;
k;
vector<ll> x;
for(ll j = 59; j > 0; --j)
{
if((z << j) > k) continue;
x.push_back(j);
k -= (z << j);
sum += j;
break;
}
for(ll t = 1; t <= 100000; ++t)
for(ll j = 59; j > 0; --j)
{
if((z << j) - 1 > k) continue;
ll _j = j - rnd() % (z + 2);
_j = max(1ll, j);
x.push_back(_j);
k -= (z << _j) - 1;
sum += _j;
}
ll cur = 0;
vector<int> ans;
for(ll t : x)
{
for(ll i = cur + t; i > cur; --i)
ans.push_back(i - 1);
cur += t;
}
reverse(ans.begin(), ans.end());
return ans;
}
//signed main()
//{
// ios_base::sync_with_stdio(0);
// cin.tie(0), cout.tie(0);
// ll n;
// cin >> n;
// for(auto i : construct_permutation(n))
// cout << i << ' ';
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |