This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Sylwia Sapkowska
#include <bits/stdc++.h>
#include "perm.h"
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;
void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << "'" << x << "'";}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
typedef pair<int, int> T;
const int oo2 = 1e9+7, K = 30;
typedef long long ll;
vector<int> construct_permutation(ll k){
vector<int>ans;
function<void(ll)>rec = [&](ll n){
if (!n) return;
int mx = 0, mn = 0;
rec(n/2);
for (auto x: ans) {
mx = max(mx, x);
mn = min(mn, x);
}
if (n&1) {
ans.emplace_back(mx+1);
} else {
ans.emplace_back(mn-1);
}
};
rec(k-1);
debug(ans);
auto s = ans;
sort(s.begin(), s.end());
vector<int>ret;
for (int i = 0; i<(int)ans.size(); i++){
ret.emplace_back((int)(lower_bound(s.begin(), s.end(), ans[i])-s.begin()));
}
debug(ret);
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |