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;
#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for (int i = 0, _n = n; i < _n; ++i)
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define FORE(it, s) for (__typeof(s.begin()) it = (s).begin(); it != (s).end(); ++it)
template <class U, class V> bool maximize(U &A, const V &B) { return (A < B) ? (A = B, true) : false; }
template <class U, class V> bool minimize(U &A, const V &B) { return (A > B) ? (A = B, true) : false; }
template <class T> void print_vector(const vector <T> &a) {
for (auto x : a) cout << x << " "; cout << '\n';
}
vector <int> addition(vector <int> a, vector <int> b) {
for (auto &x : a) x += (int) b.size();
for (auto &x : b) a.push_back(x);
return a;
}
vector <int> get(int p) {
vector <int> ans(p);
iota(ALL(ans), 0);
return ans;
}
vector <int> construct_permutation(long long K) {
vector <int> ans;
REP(i, 60) if(BIT(K, i)) ans = addition(ans, get(i));
REP(i, (int) __builtin_popcountll(K) - 1) ans.insert(ans.begin(), (int) ans.size());
return ans;
}
Compilation message (stderr)
perm.cpp: In function 'void print_vector(const std::vector<_Tp>&)':
perm.cpp:18:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
18 | for (auto x : a) cout << x << " "; cout << '\n';
| ^~~
perm.cpp:18:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
18 | for (auto x : a) cout << x << " "; cout << '\n';
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |