QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#801855 | #9874. Matrix Construction | ucup-team5657# | WA | 0ms | 3904kb | C++20 | 1.1kb | 2024-12-07 10:20:01 | 2024-12-07 10:20:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L+R) >> 1)
#define multiCase() int testCnt = in(); _rep(curCase,1,testCnt)
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
using ll = long long;
using pii = pair<int,int>;
int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
template<typename T> void chkmax(T &a, const T &b) { a = max(a, b); }
template<typename T> void chkmin(T &a, const T &b) { a = min(a, b); }
mt19937 umi;
int main() {
multiCase() {
int n = in(), m = in();
puts("Yes");
int cnt = 0;
_rep(i,1,n) {
if(m & 1 && i % 2 == 0) {
cnt += m;
_rep(j,1,m) out(cnt - j + 1); puts("");
} else {
_rep(j,1,m) out(++cnt); puts("");
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3904kb
input:
2 1 1 2 3
output:
Yes 1 Yes 1 2 3 6 5 4
result:
wrong answer Duplicate sum found for adjacent elements at (1,2) and (2,2) (test case 2)