QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#485826#6743. water235duckindogWA 0ms3880kbC++23681b2024-07-21 09:55:572024-07-21 09:55:58

Judging History

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

  • [2024-07-21 09:55:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3880kb
  • [2024-07-21 09:55:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

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

  int n, m; cin >> n >> m;

  int answer = 0;
  for (int i = 1, pass = 0; i <= n; i += 2, pass ^= 1) answer += (m + (pass || m == 1)) / 2;
  
  vector<vector<int>> a(n + 1, vector<int>(m + 1));
  for (int i = 1, st = 1; i <= n; i += 2, st ^= 1) { 
    if (m == 1) st = 1;
    for (int j = st; j <= m; j += 2) a[i][j] = 1;   
  }
  if (!(n & 1)) answer += (a[n][1] = 1);
  if (n == 1 && !(m & 1)) answer += (a[n][m] = 1);

  cout << answer << "\n";

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

详细

Test #1:

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

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 1
0 0 0
0 1 0

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

3
1 0 1 1

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
1 0
1 0

result:

wrong answer The answer is wrong: empty blocks exist