제출 #1139276

#제출 시각아이디문제언어결과실행 시간메모리
1139276Sang순열 (APIO22_perm)C++20
71.22 / 100
7 ms1348 KiB
#include<bits/stdc++.h> using namespace std; #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 fi first #define se second #define pb push_back #define ALL(a) (a).begin(), (a).end() #define task "kbsiudthw" typedef vector<int> vi; typedef pair<int, int> ii; typedef pair<int, ii> pii; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 2277; vector<int> construct_permutation(long long k){ vi bit, ans; int s = 0, cnt = 0; k--; while (k){ FORD(i, 60, 1){ if (k < (1ll<<i) -1 ) continue; k -= (1ll<<i) - 1; s += i; bit.pb(i); break; } } --s; for (int &x : bit){ FOR (i, s - x + 1, s){ ans.pb(i); } s -= x; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...