QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218555#6743. water235retr0WA 1ms3456kbC++141.1kb2023-10-18 15:00:542023-10-18 15:00:54

Judging History

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

  • [2023-10-18 15:00:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3456kb
  • [2023-10-18 15:00:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m; cin >> n >> m;
    int ans = 0;
    vector<vector<int>> a(n, vector<int>(m));
    for(int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (i == j) a[i][j] = 1, ans++;
        }
    }

    if(n != m) {
        if(n > m) {
            for(int i = 0, j = 0; i + 3 < n; i++, j++) {
                a[i + 3][j] = 1;
                ans++;
            }
        } else {
            for(int i = 0, j = 0; i < n; i++, j++) {
                a[i][j + 3] = 1;
                ans++;
            }
        }
    }
    if((n == 2 and m == 1) or (n == 1 and m == 2)) {
        cout << 2 << '\n';
        for(int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cout << 1 << " ";
            }
            cout << '\n';
        }
        return 0;
    }
    cout << ans << '\n';
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cout << a[i][j] << " ";
        }
        cout << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3420kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3416kb

input:

1 4

output:

2
1 0 0 1 

result:

wrong answer The answer is wrong: expected = 3, found = 2