Is this code ?  I can't write code

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: [email protected] <[email protected]> on behalf of 
chitaranjan pradhan <[email protected]>
Sent: Monday, September 16, 2019 11:32:15 AM
To: [email protected] <[email protected]>
Subject: [gcj]

#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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAAGy8WsjqJx3QhOKpuSkeFbFgHYsepPTzCEKebtf43xe%3DM1Ghw%40mail.gmail.com<https://groups.google.com/d/msgid/google-code/CAAGy8WsjqJx3QhOKpuSkeFbFgHYsepPTzCEKebtf43xe%3DM1Ghw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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/MN2PR05MB7152DFE5B3331A455C25C1BDA08C0%40MN2PR05MB7152.namprd05.prod.outlook.com.

Reply via email to