# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718576 | lam | Permutation (APIO22_perm) | C++17 | 2 ms | 340 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 ll long long
using namespace std;
void add(vector <int> &ans, vector <int> tmp)
{
vector <int> tmp2;
for (int i:tmp) if (i>0) tmp2.push_back(i);
sort(tmp2.begin(),tmp2.end());
for (int i:tmp2)
for (int &j:ans) if (j>=i) j++;
int bound = ans.size() + tmp.size();
for (int i:tmp) if (i<=0) ans.push_back(bound+i);
else ans.push_back(i);
}
vector<int> construct_permutation(long long k)
{
vector <int> res;
if (k==1) return res;
if (k==2) return vector <int>({0});
if (k==3) return vector <int>({1,0});
vector <int> digits;
while (k>0)
{
digits.push_back(int(k&1));
k>>=1;
}
reverse(digits.begin(),digits.end());
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |