Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Iterative Subset Generation
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- using namespace __gnu_pbds;
- using namespace std;
- typedef long long ll;
- #define mem(dp,a) memset(dp,a,sizeof dp)
- #define rep(i,a,b) for(ll i=a;i<b;i++)
- #define pb(x) push_back(x)
- #define mp(x,y) make_pair(x,y)
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
- #define F first
- #define S second
- #define all(v) (v).begin(),(v).end()
- #define pi 3.14159265359
- ll INF=1e18+10;
- ll MOD=1000000007;
- const int N=10;int n;
- int a[N];
- int main()
- {
- cin>>n;
- rep(i,0,n)cin>>a[i];
- rep(i,0,(1<<n))
- {
- rep(j,0,n)
- if(i&(1<<j))
- cout<<a[j]<<" ";
- cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement