QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#769965#5438. Half MixedFalse0099WA 0ms3640kbC++201.5kb2024-11-21 20:06:342024-11-21 20:06:35

Judging History

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

  • [2024-11-21 20:06:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-11-21 20:06:34]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;

void solve(int T) {
    for (int _ = 0; _ < T; ++_) {
        int n, m;
        cin >> n >> m;
        bool possible = true;
        if (n == 1 && m == 1) {
            cout << "No" << endl;
            continue;
        }
        if (n == 1) {
            if (m == 3) {
                cout << "Yes" << endl;
                cout << "0 1 0" << endl;
            } else {
                cout << "No" << endl;
            }
            continue;
        }
        if (m == 1) {
            if (n == 3) {
                cout << "Yes" << endl;
                cout << "0" << endl << "1" << endl << "0" << endl;
            } else {
                cout << "No" << endl;
            }
            continue;
        }
        // For n >=2 and m >=2, construct a matrix with alternating rows starting with 0 and 1
        cout << "Yes" << endl;
        for (int i = 0; i < n; ++i) {
            if (i % 2 == 0) {
                for (int j = 0; j < m; ++j) {
                    cout << (j % 2 == 0 ? "0" : "1");
                    if (j < m - 1) cout << " ";
                }
            } else {
                for (int j = 0; j < m; ++j) {
                    cout << (j % 2 == 0 ? "1" : "0");
                    if (j < m - 1) cout << " ";
                }
            }
            cout << endl;
        }
    }
}

int main() {
    int T;
    cin >> T;
    solve(T);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3640kb

input:

2
2 3
1 1

output:

Yes
0 1 0
1 0 1
No

result:

wrong answer 12 Mixed Submatrices Found, but 9 Expected (test case 1)