QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#883863 | #9874. Matrix Construction | galiyuu# | WA | 1ms | 3840kb | C++23 | 931b | 2025-02-05 19:29:14 | 2025-02-05 19:29:15 |
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);
puts("Yes");
vector<vi> ans(n,vi(m));
ans[0][0]=1;
int id=n*m;
rep(i,1,n+m) rep(j,0,n) {
if (j>i) continue;
if (i-j>=m) continue;
ans[j][i-j]=id;
id--;
}
rep(i,0,n) rep(j,0,m) {
printf("%d ",ans[i][j]);
if (j==m-1) puts("");
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3840kb
input:
2 1 1 2 3
output:
Yes 1 Yes 1 6 4 5 3 2
result:
wrong answer Duplicate sum found for adjacent elements at (1,3) and (2,3) (test case 2)