QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#218513#6743. water235retr0WA 0ms3760kbC++14678b2023-10-18 14:20:202023-10-18 14:20:21

Judging History

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

  • [2023-10-18 14:20:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3760kb
  • [2023-10-18 14:20:20]
  • 提交

answer

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

int main() {
    int n, m; cin >> n >> m;
    int ans = 1;
    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) {
            a[n - 1][0] = 1;
            ans++;
        }
        if(n < m) {
            a[0][m - 1] = 1;
            ans++;
        }
    }
    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: 0
Wrong Answer
time: 0ms
memory: 3760kb

input:

2 1

output:

3
1 
1 

result:

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