Submission #1060930

#TimeUsernameProblemLanguageResultExecution timeMemory
1060930KasymKPermutation (APIO22_perm)C++17
10 / 100
1 ms348 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} vector<int> construct_permutation(ll k){ if(k <= 90){ vector<int> A; for(int i = k-2; i >= 0; --i) A.pb(i); return A; } vector<int> A; int c = 0, d = 0; bool ok = false; vector<int> ans; for(int i = 60; i >= 0; --i){ if(ok){ A.pb(c); c++; if(k>>i&1){ d--; A.pb(d); } } if(k>>i&1) ok = true; } for(auto &i : A) ans.pb(i-d); return A; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...