Submission #1107102

#TimeUsernameProblemLanguageResultExecution timeMemory
1107102vladiliusPermutation (APIO22_perm)C++17
91.33 / 100
1 ms504 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second vector<int> construct_permutation(ll k){ vector<int> p; int cc = 0; if (k % 2){ p.pb(1e9); p.pb(cc++); k = (k - 1) / 2 - 1; } else { p.pb(cc++); k = k / 2 - 1; } while (k > 0){ if (k % 2){ p.pb(cc++); k = (k - 1) / 2; } else { p.pb(1e9); p.pb(cc++); k = k / 2 - 1; } } for (int i = (int) p.size() - 1; i >= 0; i--){ if (p[i] == 1e9){ p[i] = cc++; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...