QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140958#6743. water235UFRJ#WA 1ms3564kbC++20931b2023-08-17 01:25:502023-08-17 01:25:51

Judging History

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

  • [2023-08-17 01:25:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3564kb
  • [2023-08-17 01:25:50]
  • 提交

answer

#include<bits/stdc++.h>

using lint = int64_t;
using namespace std;

int main(void) {
  cin.tie(nullptr)->sync_with_stdio(false);

  int n, m;
  int  cnt = 0;

  cin >> n >> m;

  vector<vector<bool>> ans(n, vector<bool>(m));

  for(int i = 0; i < n; i += 4) {
    for(int j = 0; j < m; j += 2) {
      ans[i][j] = 1;
      cnt++;
    }
  }

  for(int i = 2; i < n; i += 4) {
    for(int j = 1-(m == 1); j < m; j += 2) {
      ans[i][j] = 1;
      cnt++;
    }
  }


  if(n == 2 and m == 2) {
    ans[0][1] = 1;
    ans[1][0] = 1;
    cnt += 2;
  }
  else if(m == 2) {
    ans[0][1] = 1;
    cnt++;
  } else if(n == 2) {
    ans[1][0] = 1;
    cnt++;
  }

  if(n % 2 == 0 and n != 2) {
    ans[n-1][0] = 1;
  }

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


  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 1 
0 0 0 
0 1 0 

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3532kb

input:

1 4

output:

2
1 0 1 0 

result:

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