QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#347870#6743. water235wtz2333WA 0ms3636kbC++141.4kb2024-03-09 15:57:492024-03-09 15:57:50

Judging History

This is the latest submission verdict.

  • [2024-03-09 15:57:50]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3636kb
  • [2024-03-09 15:57:49]
  • Submitted

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;
    int flag = 0;
    if(n > m) swap(n,m),flag = 1;
    int cnt = 0;
    if(n == 1) {
        for(int j = 0;j < m;j ++) {
            if(j % 2 == 0) cnt ++,f[0][j] = 1;
            else if(j % 2 == 1 && j == m - 1) cnt ++,f[0][j] = 1;
        }
    }
    else {
        for(int i = 0;i < n;i ++) {
            for(int j = 0;j < n;j ++) {
                if(i == j){
                    f[i][j] = 1;
                    cnt ++;
                }
            }
        }
        for(int i = n + 1;i < m;i += 2) {
            cnt ++;
            f[0][i] = 1;
        }
        if(f[0][m - 1] == 0){
            cnt ++;
            f[0][m - 1] = 1;
        }
    }
    cout << cnt << endl;
    if(flag == 0) {
        for(int i = 0;i < n;i ++) {
            for(int j = 0;j < m;j ++) {
                cout << f[i][j] << " ";
            }cout << "\n";
        }
    }else {
        for(int i = 0;i < m;i ++) {
            for(int j = 0;j < n;j ++) {
                cout << f[j][i] << " ";
            }cout << "\n";
        }
    }
    // }
}

// 1 0 0 1 0 0 
// 0 1 0 0 1 0
// 0 0 0 0 0 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: 3636kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

4
1 0 1 
0 1 0 
0 0 1 

result:

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