H Holding Two
题意
构造一个 0 / 1 0/1 0/1 矩阵 A A A 使得 对任意的 A i 1 j 1 , A i 2 j 2 , A i 3 j 3 A_{i_1j_1},A_{i_2j_2},A_{i_3j_3} Ai1j1,Ai2j2,Ai3j3 都不满足 A i 1 j 1 = A i 2 j 2 = A i 3 j 3 , − 1 ≤ i 1 − i 2 = i 2 − i 3 ≤ 1 , − 1 ≤ j 1 − j 2 = j 2 − j 3 ≤ 1 A_{i_1j_1}=A_{i_2j_2}=A_{i_3j_3},-1\leq i_1-i_2=i_2-i_3\leq 1,-1\leq j_1-j_2=j_2-j_3\leq 1 Ai1j1=Ai2j2=Ai3j3,−1≤i1−i2=i2−i3≤1,−1≤j1−j2=j2−j3≤1
直接两排010101… 在跟上两排 10101…构造即可
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j, k) for (ll(i) = (j); (i) <= (k); (++i))
typedef long long ll;
signed main() {
int n, m;
cin >> n >> m;
if (n & 1) {
rep(i, 1, m) cout << ('0' + i & 1);
cout << endl;
n--;
}
rep(i, 1, n / 2) {
rep(j, 1, m) cout << char('0' + (j % 2 + i % 2) % 2);
cout << endl;
rep(j, 1, m) cout << char('0' + (j % 2 + i % 2) % 2);
cout << endl;
}
return 0;
}