# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714368 | Swan | Permutation (APIO22_perm) | C++17 | 0 ms | 0 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>
#include <stack>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
//#define int long long
#define INP freopen("palpath.in","r",stdin)
#define OUTP freopen("palpath.out","w",stdout)
using ld = long double;
using LD = ld;
using namespace std;
bitset<64> getBits(long long x) {
int pnt = 0;
bitset<64> res;
while(x) {
res[pnt++] = x%2;
x/=2;
}
return res;
}
vector<int> construct_permutation(long long k) {
bitset<64> bits (k);
int mx = 0;
for (int i = 0; i < 64; i++) {
if (bits[i]) {
mx = i;
}
}
vector<int> res;
for (int i = 0; i < mx; i++) {
res.push_back(i);
}
for (int i = mx - 1; i >= 0; i--) {
if (!bits[i]) {
continue;
}
for (int j = 0; j < res.size(); j++) {
if(res[j] >= i) {
res[j]++;
}
}
res.push_back(i);
}
return res;
}
int main(){
ios_base::sync_with_stdio(0);
/* int k; cin >> k;
vector<int> kek = construct_permutation(k);
for (int i = 0; i < kek.size(); i++) {
cout << kek[i] << ' ';
}
cout << endl;
check(kek);*/
return 0;
}