#include <iostream>
#include <algorithm>
#include <vector>

int main() {
    int n, r;
    std::cin >> n;
    std::cin >> r;

    std::vector<bool> v(n);
    std::fill(v.end() - r, v.end(), true);
int c=0;
    do {
        for (int i = 0; i < n; ++i) {
            if (v[i]) {
                std::cout << (i) << " ";
            }
        }
        c++;
        std::cout << "\n";
    } while (std::next_permutation(v.begin(), v.end()));
    std::cout<<c;
return 0;
}
input
5
3
0 1
2 3
0 1
output
8
as total subset is
3 4
2 4
2 3
1 4
1 3
1 2
0 4
0 3
0 2
0 1
total number of subset
10
but input is has 3 subset {0,1}{2,3}{0.1} to be remove so output is 8

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAAGy8WsjqJx3QhOKpuSkeFbFgHYsepPTzCEKebtf43xe%3DM1Ghw%40mail.gmail.com.

Reply via email to