QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#883814 | #9874. Matrix Construction | galiyuu# | WA | 1ms | 3840kb | C++23 | 862b | 2025-02-05 19:07:17 | 2025-02-05 19:07:24 |
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);
int id=n*m;
puts("Yes");
vector<vi> ans(n,vi(m));
rep(j,0,m) rep(i,0,n) {
ans[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: 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: 1ms
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 121 110 99 88 77 66 55 44 33 22 11 131 120 109 98 87 76 65 54 43 32 21 10 130 119 108 97 86 75 64 53 42 31 20 9 129 118 107 96 85 74 63 52 41 30 19 8 128 117 106 95 84 73 62 51 40 2...
result:
wrong answer Duplicate sum found for adjacent elements at (6,1) and (7,1) (test case 2)