QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#837110 | #9874. Matrix Construction | beast_ancestor | WA | 2ms | 3720kb | C++11 | 1.1kb | 2024-12-29 16:06:43 | 2024-12-29 16:06:43 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<utility>
using namespace std;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define lop(i,r,l) for(int i=r;i>=l;i--)
#define inf 0x3f3f3f3f3f3f3f3f
#define mk(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define deb(x,s) cout<<s<<": "<<x<<endl;
#define ios ios::sync_with_stdio(false);cin.tie(nullptr),cout.tie(nullptr);
#define i8 __int128
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1e3 + 10;
int a[N][N], n, m;
void solve() {
cin >> n >> m;
int c = 0;
if (n > m) {
rep(i, 1, n) {
rep(j, 1, m) {
a[i][j] = ++c;
}
}
}
else {
rep(j, 1, m) {
rep(i, 1, n) {
a[i][j] = ++c;
}
}
}
cout << "yes\n";
rep(i, 1, n) {
rep(j, 1, m) {
cout << a[i][j] << " ";
}
cout << '\n';
}
}
int main() {
ios;
int __;
//__ = 1;
cin >> __;
while (__--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
2 1 1 2 3
output:
yes 1 yes 1 3 5 2 4 6
result:
ok All test cases passed. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3720kb
input:
361 4 9 11 12 16 14 3 7 17 13 1 19 12 3 15 19 11 3 8 18 13 10 8 13 9 18 14 11 7 13 6 16 12 13 1 6 11 15 18 19 5 6 17 19 2 3 17 11 16 19 6 14 5 9 7 2 5 11 15 16 3 15 7 11 16 2 19 15 5 19 2 17 13 12 3 5 19 14 6 3 18 2 16 4 6 8 10 9 17 4 5 16 17 9 16 11 6 9 16 5 3 19 18 9 13 9 12 19 6 13 17 15 13 7 12 ...
output:
yes 1 5 9 13 17 21 25 29 33 2 6 10 14 18 22 26 30 34 3 7 11 15 19 23 27 31 35 4 8 12 16 20 24 28 32 36 yes 1 12 23 34 45 56 67 78 89 100 111 122 2 13 24 35 46 57 68 79 90 101 112 123 3 14 25 36 47 58 69 80 91 102 113 124 4 15 26 37 48 59 70 81 92 103 114 125 5 16 27 38 49 60 71 82 93 104 115...
result:
wrong answer Duplicate sum found for adjacent elements at (6,1) and (7,1) (test case 2)