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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> construct_permutation(long long k) {
vector<vector<int>> ans;
int last = 0;
for(int i = 59; i >= 0; i -= 5) {
ll cur = 0;
for(int j = i, z = 4; j > i - 5; j--, z--) {
cur += (k >> j & 1) << z;
}
if(cur > 0) {
ans.push_back({});
for(int j = 0; j < i - 4; j++) {
ans.back().push_back(last);
last++;
}
for(int j = 0; j < cur - 1; j++) {
ans.back().push_back(last + cur - j - 2);
}
last += cur - 1;
}
}
vector<int> ret;
for(auto x : ans) {
for(auto i : x) ret.push_back(i);
}
return ret;
}
// int main() {
// cin.tie(0); ios_base::sync_with_stdio(0);
// auto v = construct_permutation((1LL << 59) + 1);
// for(auto x : v) {
// cout << x << " ";
// }
// cout << '\n';
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |