QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#883863#9874. Matrix Constructiongaliyuu#WA 1ms3840kbC++23931b2025-02-05 19:29:142025-02-05 19:29:15

Judging History

This is the latest submission verdict.

  • [2025-02-05 19:29:15]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3840kb
  • [2025-02-05 19:29:14]
  • Submitted

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("");
		}
	}
}

详细

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)