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
#include <iostream>

const int M = 100;
bool C[2][M+1][M+1];
int c = 0, n = 1;

void step() {
    for (int i=0;i<M;++i)
    for (int j=0;j<M;++j) {
        C[n][i][j] = C[c][i][j];
    }
        
    for (int i=0;i<M;++i)
    for (int j=0;j<M;++j) {
        if (C[c][i][j] != C[c][i][j+1] &&
            C[c][i][j] != C[c][i+1][j] &&
            C[c][i][j] == C[c][i+1][j+1]) {
            C[n][i][j] = !C[c][i][j];
            C[n][i+1][j] = !C[c][i+1][j];
            C[n][i][j+1] = !C[c][i][j+1];
            C[n][i+1][j+1] = !C[c][i+1][j+1];
        }
    }

    for (int i=0;i<M;++i) {
        for (int j=0;j<M;++j) {
            std::clog << (C[c][i][j] ? '*' : ' ');
        }
        std::clog << std::endl;
    }
    std::clog << std::endl;
    std::clog << std::endl;
    std::swap(c,n);
}

void print() {
    for (int i=0;i<M;++i) {
        for (int j=0;j<M;++j) {
            std::cout << (C[c][i][j] ? '1' : '0');
        }
        std::cout << std::endl;
    }
}

int main() {
    std::ios_base::sync_with_stdio(0);
    for (int i=0;i<M;++i)
    for (int j=0;j<M;++j) {
        C[c][i][j] = i%2 == 1;
    }
    for (int i=2;i<M;++i) C[c][0][i] = false;
    C[c][0][1] = false;
    C[c][1][0] = false;
    C[c][0][0] = true;
    C[c][1][1] = true;

    for (int i=2;i<M;i+=2) {
        C[c][i][M-1] = !C[c][i][M-1];
        C[c][i+1][0] = !C[c][i+1][0];
    }

    print();
    // for (int i=0;i<M*M;++i) {
    //     std::clog << i << ":: " << std::endl;
    //     step();
    // }

    return 0;
}