#include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(),x.end()
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << " " << p.second; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#define ASSERT(...) 42
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int oo = 1e9;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
const int n = 100;
vector<string> s(n,string(n,'0'));
for(int i=2;i<n;++i) {
s[0][i]=s[0][i-1]^1;
s[1][i]=s[1][i-1]^1;
}
bool last=1;
for(int j=2;j<n;++j) {
if(last) {
s[j][n-2]=s[j][n-1]=(s[j-1][n-1]^1);
for(int i=n-3;i>=0;--i) s[j][i] = s[j][i+1]^1;
} else {
s[j][0]=s[j][1]=(s[j-1][0]^1);
for(int i=2;i<n;++i) s[j][i]=s[j][i-1]^1;
}
last^=1;
}
for(int i=0;i<n;++i) for(int j=0;j<n;++j) {
if((i+j)%2) s[i][j]^=1;
}
for(auto x : s) cout << x << '\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 | #include "bits/stdc++.h" using namespace std; #define all(x) x.begin(),x.end() template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << " " << p.second; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #define ASSERT(...) 42 #endif typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; const int oo = 1e9; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); const int n = 100; vector<string> s(n,string(n,'0')); for(int i=2;i<n;++i) { s[0][i]=s[0][i-1]^1; s[1][i]=s[1][i-1]^1; } bool last=1; for(int j=2;j<n;++j) { if(last) { s[j][n-2]=s[j][n-1]=(s[j-1][n-1]^1); for(int i=n-3;i>=0;--i) s[j][i] = s[j][i+1]^1; } else { s[j][0]=s[j][1]=(s[j-1][0]^1); for(int i=2;i<n;++i) s[j][i]=s[j][i-1]^1; } last^=1; } for(int i=0;i<n;++i) for(int j=0;j<n;++j) { if((i+j)%2) s[i][j]^=1; } for(auto x : s) cout << x << '\n'; } |
English