QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#838821#9874. Matrix ConstructionwxhtzdyWA 0ms3740kbC++20725b2025-01-01 01:19:322025-01-01 01:19:33

Judging History

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

  • [2025-01-01 01:19:33]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2025-01-01 01:19:32]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, int>>> cells(n + m);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cells[i + j].emplace_back(i, j);
      }
    }
    vector<vector<int>> a(n, vector<int>(m));
    int val = 0;
    for (int d = 0; d < n + m; d++) {
      for (auto& p : cells[d]) {
        a[p.first][p.second] = ++val;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << a[i][j] << " ";
      }
      cout << '\n';
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3740kb

input:

2
1 1
2 3

output:

1 
1 2 4 
3 5 6 

result:

wrong answer Token parameter [name=ok] equals to "1", doesn't correspond to pattern "[yY][eE][sS]" (test case 1)