QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#439895#6743. water235suibian_xiaozhao#WA 1ms3580kbC++231.6kb2024-06-12 20:22:132024-06-12 20:22:15

Judging History

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

  • [2024-06-12 20:22:15]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3580kb
  • [2024-06-12 20:22:13]
  • 提交

answer

//
// Created by DELLPC on 24-5-19.
//

#include "bits/stdc++.h"

using namespace std;


using i64 = long long;
using i32 = unsigned int;
#define  endl '\n'
i64 mod = 998244353;

i64 qpow(i64 a, i64 b, i64 mods = 1e9 + 7) {
    i64 ans = 1;
    while (b) {
        if (b & 1) {
            ans = ans * a % mods;
        }
        a = a * a % mods;
        b >>= 1;
    }
    return ans;
}

//求逆元
i64 inv(i64 a, i64 mods = 1e9 + 7) {
    return qpow(a, mods - 2, mods);
}


void solve() {
    int n, m;
    cin >> n >> m;
//    cerr << n << m << endl;
    vector<vector<int>> arr(n + 1, vector<int>(n + 1));
    int k = 0;
    if (n % 2 == 0 && m % 2 == 0) {
        for (int i = 1; i <= n; i += 2) {
            arr[i][1] = 1;
            k++;
        }
        for (int i = 2; i <= m; i += 2) {
            arr[n][i] = 1;
            k++;
        }
    } else {
        for (int i = 1; i <= n; i += 2) {
            arr[i][1] = 1;
            k++;
        }

        if (n % 2 == 0) {
            arr[n][1] = 1;
            k++;
        }
        for (int i = 1; i <= m; i += 2) {
            arr[1][i] = 1;
            k++;
        }

        if (m % 2 == 0) {
            arr[1][m] = 1;
            k++;
        }
    }
    cout << k << endl;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cout << arr[i][j] << " ";
        }
        cout << endl;
    }
}

int main() {
//    cerr    << 1996488708ll * 2ll %mod<<endl;
    ios::sync_with_stdio(0), cin.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }


}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3580kb

input:

2 1

output:

3
1 
1 

result:

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