1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <bits/stdc++.h>

using namespace std;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);

    int n, m;

    cin >> n >> m;

    vector<pair<int, int>> orders;

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        orders.push_back({a, b});
    }


    for (int ready = 1; ready <= n; ready++) {
        int counter = 0;
        int counter_s = 0;
        for (int i = 0; i <= n - ready; i++) {
            unsigned long long start = 0;

            for (int j = i; j < i + ready; j++) {
                start |= (1ULL << j);
            }

            set<long long> possible;
            possible.insert(start);
            // vector<long long> possible;

            for (int j = m - 1; j >= 0; j--) {
                int a = orders[j].first;
                int b = orders[j].second;
                // vector<long long> new_possible;
                set<long long> new_possible;
                for (long long s : possible) {
                    if ((s & (1ULL << (a - 1))) && !(s & (1ULL << (b - 1)))) {

                    } else if (!(s & (1ULL << (a - 1))) && (s & (1ULL << (b - 1)))) {
                        new_possible.insert(s);
                        // new_possible.push_back(s);
                        long long new_s = s;
                        new_s |= (1ULL << (a - 1));
                        new_s &= ~(1ULL << (b - 1));
                        new_possible.insert(new_s);
                        // new_possible.push_back(new_s);
                    } else if ((s & (1ULL << (a - 1))) && (s & (1ULL << (b - 1)))) {
                        new_possible.insert(s);
                        // new_possible.push_back(s);
                    } else if (!(s & (1ULL << (a - 1))) && !(s & (1ULL << (b - 1)))) {
                        new_possible.insert(s);
                        // new_possible.push_back(s);
                    }
                }
                possible = new_possible;
            }
            counter += possible.size() % 2;
        }
        cout << counter % 2 << ' ';
    }
    cout << endl;


    return 0;
}