Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ALEX ENACHE
- #include <vector>
- #include <algorithm>
- #include <math.h>
- #include <iomanip>
- #include <bitset>
- #include <queue>
- #include <deque>
- #include <stack>
- #include <string>
- #include <map>
- #include <unordered_map>
- #include <set>
- #include <unordered_map>
- #include <random>
- #include <time.h>
- #include <assert.h>
- #include <iostream>
- using namespace std;
- #pragma warning(disable:4996)
- int n;
- int mat[7][7];
- void pas(int i, int j);
- void back(int i, int j) {
- if (i == n + 1 && j == 1) {
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- cout << mat[i][j] << " ";
- }
- cout << '\n';
- }
- cout << '\n';
- return;
- }
- if (i == j) {
- mat[i][j] = 0;
- pas(i, j);
- }
- else if (i > j) {
- pas(i, j);
- }
- else {
- mat[i][j] = 0;
- mat[j][i] = 0;
- pas(i, j);
- mat[i][j] = 1;
- mat[j][i] = 1;
- pas(i, j);
- }
- }
- void pas(int i, int j) {
- if (j == n) {
- back(i + 1, 1); //rand nou
- }
- else {
- back(i, j + 1); //continuam randul
- }
- }
- int main() {
- //freopen("input", "r", stdin);freopen("output", "w", stdout);
- freopen("gengraf.in", "r", stdin);freopen("gengraf.out", "w", stdout);
- cin >> n;
- int put = n * (n - 1) / 2;
- int ans = 1;
- //for (int i = 1; i <= put; i++) ans *= 2;
- //while (put--) ans *= 2;
- ans = (1 << put);
- cout << ans << '\n';
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- mat[i][j] = -1;
- }
- }
- back(1, 1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement