Cod sursa(job #3241034)

Utilizator Tudor.1234Holota Tudor Matei Tudor.1234 Data 25 august 2024 10:26:45
Problema Generare de permutari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.73 kb
#include "bits/stdc++.h"
std :: vector < int > v;
int n;
inline static void Precompute(){
                std :: cin >> n;
                for(int i = 1; i <= n; i++){
                         v.push_back(i);
                }
}
inline static void Solve(){
            Precompute();
            do{
                    for(auto i : v){
                           std :: cout << i << ' ';
                    }
                    std :: cout << '\n';
            }while(std :: next_permutation(v.begin(), v.end()));
}
signed main(){
     freopen("permutari.in","r",stdin);
     freopen("permutari.out","w",stdout);
     std :: ios_base :: sync_with_stdio(false);
     std :: cin.tie(0);
     std :: cout.tie(0);
     Solve();
     return 0;
}