제출 #1225059

#제출 시각아이디문제언어결과실행 시간메모리
1225059KALARRYPermutation (APIO22_perm)C++20
71.22 / 100
7 ms1352 KiB
//chcockolateman #include<bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { k--; int counter = -1; vector<int> seq; while(k) { int pos = 0; while((1ll<<(pos+1)) - 1 <= k) pos++; seq.push_back(pos); counter += pos; // printf("Pos = %d\n",pos); k -= ((1ll<<pos) - 1); } vector<int> ret; for(int L = 0 ; L < seq.size() ; L++) { counter = counter - seq[L] + 1; for(int i = 1 ; i <= seq[L] ; i++) ret.push_back(counter++); counter = counter - seq[L] - 1; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...