|
|
|
@ -26,7 +26,8 @@ long binom(long n, long k) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get the (n choose k) possible variable choices at index idx
|
|
|
|
// get the (n choose k) possible variable choices at index idx
|
|
|
|
// example:
|
|
|
|
// example: unrank_combination(5,3,5) -> (1,4,5)
|
|
|
|
|
|
|
|
// the full combination list would look like: (1,2,3), (1,2,4), (1,2,5), (1,3,4), (1,3,5), (1,4,5) <- this is the combination on index 5
|
|
|
|
std::vector<int> unrank_combination(long n, long k, long long idx) {
|
|
|
|
std::vector<int> unrank_combination(long n, long k, long long idx) {
|
|
|
|
std::vector<int> comb;
|
|
|
|
std::vector<int> comb;
|
|
|
|
comb.reserve(k);
|
|
|
|
comb.reserve(k);
|
|
|
|
|