Pagini recente » Cod sursa (job #932277) | Cod sursa (job #51957) | Cod sursa (job #3314943) | Cod sursa (job #519748) | Cod sursa (job #3312706)
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef LOCAL
freopen("permutari.in", "r", stdin);
freopen("permutari.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
vector<int> P(N);
iota(P.begin(), P.end(), 1);
do {
for (int i = 0; i < N; ++i) {
if (i) {
cout << " ";
}
cout << P[i];
}
cout << endl;
} while (next_permutation(P.begin(), P.end()));
return 0;
}