Submission #742588

#TimeUsernameProblemLanguageResultExecution timeMemory
742588fanwenPermutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#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; } vector <int> construct_permutation(long long K) { vector <int> bit; for (; K > 0; K /= 2) { bit.push_back(K % 2); } bit.pop_back(); reverse(ALL(bit)); vector <int> ans; int cur = 0; for (auto x : bit) { ans.push_back(cur++); if(x == 1) ans.insert(ans.begin(), cur++); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...