QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#347817#6743. water235wtz2333WA 0ms3748kbC++141.9kb2024-03-09 15:38:112024-03-09 15:38:13

Judging History

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

  • [2024-03-09 15:38:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2024-03-09 15:38:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mo = 998244353;
const int P = 1e9 + 7;
const int maxn = 2010;
int f[maxn][maxn];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    if(m == 1) {
        cout << n / 2 + 1 << endl;
        for(int j = 0;j < n;j ++) {
            if(j % 2 == 0)cout << 1 << "\n";
            else if(j % 2 == 1 && j == n - 1) cout << 1 << "\n";
            else cout << 0 << "\n";
        }
        return 0;
    }
    if(n == 1) {
        cout << m / 2 + 1 << endl;
        for(int j = 0;j < m;j ++) {
            if(j % 2 == 0)cout << 1 << " ";
            else if(j % 2 == 1 && j == m - 1) cout << 1 << " ";
            else cout << 0 << " ";
        }

        return 0;
    }
    int cnt = 0;
    // int nn,mm;
    // if(n % 2 == 0) nn = n - 1;
    // else nn = n;
    // if(m % 2 == 0) mm = m - 1;
    // else mm = m;
    for(int i = 0;i < n;i ++) {
        for(int j = 0;j < m;j ++) {
            if(i % 3 == 0) {
                if(j % 3 == 0){
                    cnt ++;
                    f[i][j] = 1;
                }
            }else if(i % 3 == 1){
                if(j % 3 == 1) {
                    cnt++;
                    f[i][j] = 1;
                }
            }else if(i % 3 == 2) {
                if(j % 3 == 2) {
                    cnt ++;
                    f[i][j] = 1;
                }
            }
        }
    }
    // if(n % 2 == 0) {
    //     f[n - 1][0] = 1;
    //     cnt ++;
    // }
    // if(m % 2 == 0){
    //     f[0][m - 1] = 1;
    //     cnt ++;
    //}
    cout << cnt << endl;
    for(int i = 0;i < n;i ++) {
        for(int j = 0;j < m;j ++) {
            cout << f[i][j] << " ";
        }cout << "\n";
    }
    // }
}

// 1 0 0 1 0 0 
// 0 1 0 0 1 0
// 1 0 0 1 0 0

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

3
1 0 1 1 

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
1 0 
0 1 

result:

ok The answer is correct.

Test #5:

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

input:

2 4

output:

3
1 0 0 1 
0 1 0 0 

result:

ok The answer is correct.

Test #6:

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

input:

4 3

output:

4
1 0 0 
0 1 0 
0 0 1 
1 0 0 

result:

ok The answer is correct.

Test #7:

score: -100
Wrong Answer
time: 0ms
memory: 3624kb

input:

4 4

output:

6
1 0 0 1 
0 1 0 0 
0 0 1 0 
1 0 0 1 

result:

wrong answer The answer is wrong: expected = 4, found = 6