QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#306258#6309. AqrechebenWA 1ms3912kbC++141.6kb2024-01-16 16:29:132024-01-16 16:29:14

Judging History

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

  • [2024-01-16 16:29:14]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3912kb
  • [2024-01-16 16:29:13]
  • 提交

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)