QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306283 | #6309. Aqre | cheben | WA | 0ms | 3744kb | C++14 | 1.0kb | 2024-01-16 16:58:43 | 2024-01-16 16:58:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
int tmp[4][4] = {
{0, 1, 1, 1},
{1, 1, 1, 0},
{1, 0, 1, 1},
{1, 1, 0, 1},
};
int T;
scanf("%d", &T);
while (T--) {
int m, n;
scanf("%d%d", &m, &n);
if (m < 4 && n < 4) {
printf("%d\n", m * n);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
printf("1%c", (j == n - 1) ? '\n' : ' ');
}
}
continue;
}
int cnt = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (tmp[i % 4][j % 4] == 1) {
cnt++;
}
}
}
printf("%d\n", cnt);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
printf("%d%c", tmp[i % 4][j % 4], (j == n - 1) ? '\n' : ' ');
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3744kb
input:
3 2 2 3 4 3 8
output:
4 1 1 1 1 9 0 1 1 1 1 1 1 0 1 0 1 1 18 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1
result:
wrong answer Length must be equal to m (test case 1)