QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#132644#6743. water235de_sousa#WA 1ms3448kbC++17951b2023-07-30 22:38:022023-07-30 22:38:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-30 22:38:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3448kb
  • [2023-07-30 22:38:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for (int i = a; i < b; i++)
#define all(x) begin(x),end(x)
#define trav(a, b) for (auto a : b)
#define lld long long

using i64 = long long; 

void solve() {
  int n, m;
  cin >> n >> m;
  // if (n > m) swap(n, m);
  vector<vector<int> > ans(n, vector<int>(m));
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (i < m) {
      ans[i][i] = 1;
      ++res;
    }
  }
  if (n > m) {
    for (int i = m; i < n; i++) {
      ++res;
      ans[i][m - 1] = 1;
    }
  }
  if (m > n) {
    for (int i = n; i < m; i++) {
      ++res;
      ans[0][i] = 1;
    }
  }
  cout << res << '\n';
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << ' ';
    }
    cout << '\n';
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int tt = 1;
  // cin >> tt;
  while (tt--) solve();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

4
1 1 1 1 

result:

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