#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using vi = vector<int>;
void step(vector<bool>& vs, int w, int h) {
vector<bool> ans(vs.size());
for(int y = 0; y < h - 1; y++) {
for(int x = 0; x < w - 1; x++) {
if(vs[x + y * w] == vs[x + 1 + (y + 1) * w] && vs[x + 1 + y * w] == vs[x + (y + 1) * w] && vs[x + y * w] != vs[x + 1 + y * w]) {
ans[x + y * w] = 1;
ans[x + 1 + y * w] = 1;
ans[x + (y + 1) * w] = 1;
ans[x + 1 + (y + 1) * w] = 1;
}
}
}
for(int y = 0; y < h; y++) {
for(int x = 0; x < w; x++) {
ans[x + y * w] = ans[x + y * w] ^ vs[x + y * w];
}
}
vs = ans;
}
static int highScore = 0;
static int constexpr N = 100;
void print(vector<bool> vs) {
for(int y = 0; y < N; y++) {
for(int x = 0; x < N; x++) {
if(vs[x + y * N]) {
cout << "1";
}
else {
cout << "0";
}
}
cout << "\n";
}
}
pll getValue(vector<bool> vs, int w, int h) {
map<vector<bool>, int> already;
already[vs] = 0;
//print(vs);
//cout << "\n\n";
for(int i = 1;; i++) {
if(i % N == 0) {
cout << i << "\n";
}
step(vs, w, h);
//print(vs);
//cout << "\n\n";
if(already.count(vs)) {
highScore = max(highScore, i);
return {already[vs], i};
}
already[vs] = i;
}
}
void solve() {
//cout << "GOING" << endl;
vector<bool> vs(N*N);
vs[0] = 1;
for(int y = 1; y < N; y++) {
if(y % 2 == 1) {
for(int x = 1; x < N; x++) {
vs[y * N + x] = 1;
}
}
else {
vs[y * N + N - 1] = 1;
}
}
print(vs);
//auto [a, b] = getValue(vs, N, N);
//cout << a << " " << b << " " << "\n";
}
int main() {
//cout << "SIEMA?";
//return 0;
solve();
// for(int i = 0; i < N0000; i++) {
// test();
// }
// return 0;
//test();
cin.tie(0)->sync_with_stdio(0);
int t = 1;
//cin >> t;
//while(t--) {
// solve();
// cout << "\n";
//}
return 0;
}
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pll = pair<ll,ll>; using vi = vector<int>; void step(vector<bool>& vs, int w, int h) { vector<bool> ans(vs.size()); for(int y = 0; y < h - 1; y++) { for(int x = 0; x < w - 1; x++) { if(vs[x + y * w] == vs[x + 1 + (y + 1) * w] && vs[x + 1 + y * w] == vs[x + (y + 1) * w] && vs[x + y * w] != vs[x + 1 + y * w]) { ans[x + y * w] = 1; ans[x + 1 + y * w] = 1; ans[x + (y + 1) * w] = 1; ans[x + 1 + (y + 1) * w] = 1; } } } for(int y = 0; y < h; y++) { for(int x = 0; x < w; x++) { ans[x + y * w] = ans[x + y * w] ^ vs[x + y * w]; } } vs = ans; } static int highScore = 0; static int constexpr N = 100; void print(vector<bool> vs) { for(int y = 0; y < N; y++) { for(int x = 0; x < N; x++) { if(vs[x + y * N]) { cout << "1"; } else { cout << "0"; } } cout << "\n"; } } pll getValue(vector<bool> vs, int w, int h) { map<vector<bool>, int> already; already[vs] = 0; //print(vs); //cout << "\n\n"; for(int i = 1;; i++) { if(i % N == 0) { cout << i << "\n"; } step(vs, w, h); //print(vs); //cout << "\n\n"; if(already.count(vs)) { highScore = max(highScore, i); return {already[vs], i}; } already[vs] = i; } } void solve() { //cout << "GOING" << endl; vector<bool> vs(N*N); vs[0] = 1; for(int y = 1; y < N; y++) { if(y % 2 == 1) { for(int x = 1; x < N; x++) { vs[y * N + x] = 1; } } else { vs[y * N + N - 1] = 1; } } print(vs); //auto [a, b] = getValue(vs, N, N); //cout << a << " " << b << " " << "\n"; } int main() { //cout << "SIEMA?"; //return 0; solve(); // for(int i = 0; i < N0000; i++) { // test(); // } // return 0; //test(); cin.tie(0)->sync_with_stdio(0); int t = 1; //cin >> t; //while(t--) { // solve(); // cout << "\n"; //} return 0; } |
English