Cod sursa(job #3281254)

Utilizator nusuntvictorVictor Stefan nusuntvictor Data 28 februarie 2025 19:21:00
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.42 kb
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3fLL  // INF mare pentru long long
using namespace std;
/*
struct cord{
    int nod,t,w;
    bool operator<(const cord &other) const {
		return t > other.t;
	}
};

vector<int>baze(51);
vector<vector<cord>>graf(51);
vector<vector<int>>dist(1001,vector<int>(51,1e9));
bitset<51>vis;
int dijkstra(int nod, int k,int n){
    priority_queue<cord>q;
    dist[k][nod]=0;
    q.push({nod,0,0});
    while(!q.empty()){
        cord small=q.top();
        q.pop();
        if(vis[small.nod]==1)
            continue;
        vis[small.nod]=1;
        for(const auto& vec : graf[small.nod] ){
            int nxt=vec.nod;
            int cost=vec.t;
            int wat=vec.w;
            if(small.w+wat>k)
                continue;
            if(cost+small.t < dist[k][nxt]){
                dist[k][nxt]=cost+small.t;
                if(baze[nxt]==0)
                    q.push({nxt,dist[k][nxt],small.w+wat});
                else q.push({nxt,dist[k][nxt],0});
            }
        }
    }
    return dist[k][n];

}
*/
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ifstream f("submultimi.in");
    ofstream g("submultimi.out");

    int n;
    f>>n;
    for(int msk=1; msk<(1<<n); ++msk){
        for(int j=0; j<n; ++j)
            if(msk&(1<<j))
                g<<j+1<<' ';
        g<<'\n';
    }

    return 0;
}