제출 #1061353

#제출 시각아이디문제언어결과실행 시간메모리
1061353Halym2007순열 (APIO22_perm)C++17
71.22 / 100
7 ms1476 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define sz size() #define ff first #define ss second #define pb push_back #define pii pair <int, int> const int N = 2e5 + 5; vector <int> construct_permutation(ll k) { k--; ll k1 = k; vector <int> jog; int bashla = -1; for (ll i = 60; i >= 1; i--) { while ((1LL << i) - 1 <= k1) { k1 -= (1LL << i) - 1; bashla += i; } } for (ll i = 60; i >= 1; i--) { while ((1LL << i) - 1 <= k) { k -= (1LL << i) - 1; for (int kk = bashla - i + 1; kk <= bashla; ++kk) { jog.pb (kk); } bashla -= i; } } return jog; } //int main () { // freopen ("input.txt", "r", stdin); // ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); // int q; // cin >> q; // while ( q-- ) { // ll k; // cin >> k; // vector <int> kk = construct_permutation(k); // for (int i : kk) { // cout << i << " "; // } // cout << "\n"; // } //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...