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