QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#485831#6743. water235duckindogWA 1ms3616kbC++23603b2024-07-21 10:11:452024-07-21 10:11:45

Judging History

This is the latest submission verdict.

  • [2024-07-21 10:11:45]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3616kb
  • [2024-07-21 10:11:45]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

int32_t main() { 
  cin.tie(0)->sync_with_stdio(0);

  int n, m; cin >> n >> m;
  vector<vector<int>> a(n + 1, vector<int>(m + 1));


  for (int i = 3; i <= n; i += 2) a[i][m] = 1;
  if (!(n & 1)) a[n][m] = 1;

  for (int j = 1; j <= m; j += 2) a[1][j] = 1;
  if (n == 1) a[1][m] = 1;

  int answer = 0;
  for (int i = 1; i <= n; ++i) { 
    for (int j = 1; j <= m; ++j) answer += a[i][j];
  }
  
  cout << answer << "\n";
  for (int i = 1; i <= n; ++i) { 
    for (int j = 1; j <= m; ++j) cout << a[i][j] << " \n"[j == m];
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 1
0 0 0
0 0 1

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

3
1 0 1 1

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
1 0
0 1

result:

ok The answer is correct.

Test #5:

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

input:

2 4

output:

3
1 0 1 0
0 0 0 1

result:

ok The answer is correct.

Test #6:

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

input:

4 3

output:

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

result:

ok The answer is correct.

Test #7:

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

input:

4 4

output:

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

result:

wrong answer The answer is wrong: empty blocks exist