제출 #1060988

#제출 시각아이디문제언어결과실행 시간메모리
1060988Muhammet순열 (APIO22_perm)C++17
71.22 / 100
8 ms1372 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; #define ll long long #define sz(s) (int)s.size() vector<int> construct_permutation(ll k){ int x = -1; deque <int> v2; bool tr = 1; while(k > 0){ vector <int> v1; ll k1 = 2; x++; v1.push_back(x); while((k1-1+tr) < k){ if(k/2 < (k1-1+tr)) break; x++; v1.push_back(x); k1 *= 2; } if(k1-1+tr > k){ k1 /= 2; v1.pop_back(); x--; } k -= (k1-1+tr); for(int i = sz(v1)-1; i >= 0; i--){ v2.push_front(v1[i]); } tr = 0; } vector <int> v; for(int i = 0; i < sz(v2); i++){ v.push_back(v2[i]); } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...