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