QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#838821 | #9874. Matrix Construction | wxhtzdy | WA | 0ms | 3740kb | C++20 | 725b | 2025-01-01 01:19:32 | 2025-01-01 01:19:33 |
Judging History
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)