QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290176 | #6309. Aqre | zzuqy# | WA | 1ms | 5776kb | C++14 | 676b | 2023-12-24 15:09:37 | 2023-12-24 15:09:37 |
Judging History
answer
#include <bits/stdc++.h>
#define N 2009
using namespace std;
int a[N][N], b[N][N];
int n, m;
void solve() {
cin >> n >> m;
int cnt1 = 0, cnt2 = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
a[i][j] = (!!(i % 4) == !!(j % 4));
b[i][j] = ((i + j) % 4 != 3);
if (a[i][j])
cnt1++;
if (b[i][j])
cnt2++;
}
}
cout << max(cnt1, cnt2) << endl;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
int tmp = 0;
if (cnt1 > cnt2)
tmp = a[i][j];
else
tmp = b[i][j];
putchar(tmp + '0');
}
putchar('\n');
}
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5776kb
input:
3 2 2 3 4 3 8
output:
4 11 11 9 1011 0111 1110 18 10111011 01110111 11101110
result:
wrong answer 1s are not connected. (test case 2)