QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#211622#6743. water235psycho#WA 1ms3536kbC++141.4kb2023-10-12 19:29:442023-10-12 19:29:45

Judging History

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

  • [2023-10-12 19:29:45]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3536kb
  • [2023-10-12 19:29:44]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

pair<int, vector<vector<int>>> get(int n, int m) {
    vector<vector<int>> a(n, vector<int>(m, 0));
    int cnt = 0;
    for (int i = 0, s = 0; i < n; i += 2, s ^= 1) {
        for (int j = s; j < m; j += 2) {
            a[i][j] = 1;
            ++cnt;
        }
        if (n % 2 == 0 && i + 1 == n - 1) {
            for (int j = 0; j < m; j += 2) {
                a[i + 1][j] = 1;
                ++cnt;
            }
        }
    }
    return make_pair(cnt, a);
}

void print(vector<vector<int>> a) {
    for (auto &el: a) {
        for (auto &i: el) cerr << i << ' ';
        cerr << '\n';
    }
    cerr << '\n';
}

int32_t main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    bool fl = true;
    if (n < m) {
        swap(n, m);
        fl = false;
    }
    vector<pair<int, int>> x;
    for (int i = 0; i < m; ++i) {
        x.push_back({i + 1, i + 1});
    }
    while (x.back().first < n) x.push_back({min(x.back().first + 2, n), 1});
    vector<vector<int>> o(n, vector<int>(m));
    if (fl) {
        cout << x.size() << '\n';
        for (auto [x, y] : x) o[x - 1][y - 1] = 1;
    } else {
        cout << x.size() << '\n';
        for (auto [y, x] : x) o[x - 1][y - 1] = 1;
    }
    for (auto &i : o) {
        for (auto &j : i) cout << j << ' ';
        cout << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3464kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 1ms
memory: 3536kb

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: 0ms
memory: 3508kb

input:

1 4

output:

3
1 
0 
0 
0 

result:

wrong answer Invalid output