제출 #777303

#제출 시각아이디문제언어결과실행 시간메모리
777303yeyso순열 (APIO22_perm)C++17
10 / 100
1 ms296 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k) { vector<long long> logs; int L = 0; for(int i = 0; i < log(k+1) * 2; i ++){ if(pow(2, i) <= k) { logs.push_back(pow(2, i)); L = i; } } vector<int> res(L, 0); k -= logs[logs.size()-1]; //int x = log(k+1) / log(2) + 1; iota(res.begin(), res.end(), 0); while(k > 0){ for(int i = logs.size() - 1; i >= 0; i --){ if(logs[i] <= k){ res.insert(res.begin() + i, L); k -= logs[i]; break; } } L += 1; } /*for(int i = 0; i < res.size(); i ++){ cout << res[i] << " "; }*/ return res; } /* g++ -std=gnu++17 -Wall -O2 -static -o perm grader.cpp perm.cpp */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...