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
#include <iostream>
#include <vector>
using namespace std;

vector<vector<int>> ekran(100, vector<int>(100, 0));

void zmienStan(vector<vector<int>>& ekran) {
    vector<vector<int>> zmiany(100, vector<int>(100, 0));
    for (int i = 0; i < 99; ++i) {
        for (int j = 0; j < 99; ++j) {
            int a = ekran[i][j];
            int b = ekran[i][j+1];
            int c = ekran[i+1][j];
            int d = ekran[i+1][j+1];
            if ((a == d && b == c && a != b) || (a == b && c == d && a != c)) {
                zmiany[i][j] ^= 1;
                zmiany[i][j+1] ^= 1;
                zmiany[i+1][j] ^= 1;
                zmiany[i+1][j+1] ^= 1;
            }
        }
    }
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 100; ++j) {
            if (zmiany[i][j]) {
                ekran[i][j] ^= 1;
            }
        }
    }
}

int main() {
    for (int i = 0; i < 100; ++i) {
        for (int j = 0; j < 100; ++j) {
            cout << ekran[i][j];
        }
        cout << endl;
    }
    return 0;
}