이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//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;
if (n&1) rec(n/2);
else rec(n-1);
int mx = 0, mn = 0;
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... |