QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#883828 | #9874. Matrix Construction | galiyuu# | WA | 2ms | 3840kb | C++23 | 1.1kb | 2025-02-05 19:15:42 | 2025-02-05 19:15:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl '\n'
#define SZ(x) ((ll)(x).size())
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
mt19937 mrand(random_device{}());
int rnd(int x){return mrand()%x;}
const ll mod=998244353;
signed main() {
int tc;
scanf("%d",&tc);
while (tc--) {
int n,m;
scanf("%d%d",&n,&m);
if (n==1&&m==1) {
puts("Yes");
puts("1");
continue;
}
if (n%2&&m%2) {
puts("No");
continue;
}
int id=n*m;
puts("Yes");
vector<vi> ans(n,vi(m));
if (n%2==0) {
rep(j,0,m) rep(i,0,n) {
ans[i][j]=id;
id--;
}
} else {
rep(i,0,n) rep(j,0,m) {
ans[i][j]=id;
id--;
}
}
rep(i,0,n) rep(j,0,m) {
printf("%d ",ans[i][j]);
if (j==m-1) puts("");
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3840kb
input:
2 1 1 2 3
output:
Yes 1 Yes 6 4 2 5 3 1
result:
ok All test cases passed. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3840kb
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 36 32 28 24 20 16 12 8 4 35 31 27 23 19 15 11 7 3 34 30 26 22 18 14 10 6 2 33 29 25 21 17 13 9 5 1 Yes 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82...
result:
wrong answer Token parameter [name=ok] equals to "No", doesn't correspond to pattern "[yY][eE][sS]" (test case 4)