#include <bits/stdc++.h> using namespace std; using i64 = long long; const int N = 10000; int simulate(vector<string> a) { int h = a.size(), w = a[0].size(); unordered_set<bitset<N>> res; while (true) { bitset<N> b; vector<vector<int>> c(h, vector<int>(w)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { char x = a[i][j]; b[i*w+j] = x-'0'; if (i+1 < h && j+1 < w) { if (a[i+1][j+1] == x && a[i][j+1] != x && a[i+1][j] != x) { c[i][j] = c[i+1][j] = c[i][j+1] = c[i+1][j+1] = 1; } } } } if (res.count(b)) return res.size(); res.insert(b); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { a[i][j] ^= c[i][j]; } } } } int main() { int n = 100; vector<string> a(n, string(n, '0')); a[1][0] = a[0][1] = '1'; for (int i = 2; i < 100; i++) { a[0][i] = '1'; } for (int i = 2; i < 100; i += 2) { for (int j = 0; j < 99; j++) { a[i][j] = '1'; } } for (int i = 3; i < 100; i += 2) { a[i][0] = '1'; } for (string s: a) cout << s << '\n'; // cout << simulate(a) << '\n'; }
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 | #include <bits/stdc++.h> using namespace std; using i64 = long long; const int N = 10000; int simulate(vector<string> a) { int h = a.size(), w = a[0].size(); unordered_set<bitset<N>> res; while (true) { bitset<N> b; vector<vector<int>> c(h, vector<int>(w)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { char x = a[i][j]; b[i*w+j] = x-'0'; if (i+1 < h && j+1 < w) { if (a[i+1][j+1] == x && a[i][j+1] != x && a[i+1][j] != x) { c[i][j] = c[i+1][j] = c[i][j+1] = c[i+1][j+1] = 1; } } } } if (res.count(b)) return res.size(); res.insert(b); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { a[i][j] ^= c[i][j]; } } } } int main() { int n = 100; vector<string> a(n, string(n, '0')); a[1][0] = a[0][1] = '1'; for (int i = 2; i < 100; i++) { a[0][i] = '1'; } for (int i = 2; i < 100; i += 2) { for (int j = 0; j < 99; j++) { a[i][j] = '1'; } } for (int i = 3; i < 100; i += 2) { a[i][0] = '1'; } for (string s: a) cout << s << '\n'; // cout << simulate(a) << '\n'; } |