QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#306283#6309. AqrechebenWA 0ms3744kbC++141.0kb2024-01-16 16:58:432024-01-16 16:58:44

Judging History

你现在查看的是最新测评结果

  • [2024-01-16 16:58:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3744kb
  • [2024-01-16 16:58:43]
  • 提交

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)