QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#807316 | #9874. Matrix Construction | Wzy# | WA | 1ms | 3600kb | C++14 | 1.1kb | 2024-12-09 21:22:28 | 2024-12-09 21:22:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const int N=2e5+10,M=2e6;
const int mod=998244353;
const LL P=1e9+7;
const LL INF=1e18;
LL h[N],e[M],ne[M],w[M],idx;
LL d[N];
int n;
void solve(){
int n,m;
cin>>n>>m;
if(n==m&&n==2){
cout<<"No"<<endl;
return;
}
int res[n+10][m+10];
if(m==2){
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++){
if(i%2) res[j][i]=(i-1)*n+j;
else if(j==1) res[j][i]=i*n;
else res[j][i]=(i-1)*n+j-1;
}
}
else{
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++){
if(i%2) res[i][j]=(i-1)*m+j;
else if(j==1) res[i][j]=i*m;
else res[i][j]=(i-1)*m+j-1;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++) cout<<res[i][j]<<" ";
cout<<endl;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T=1;
cin>>T;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
input:
2 1 1 2 3
output:
1 1 2 3 6 4 5
result:
wrong answer Token parameter [name=ok] equals to "1", doesn't correspond to pattern "[yY][eE][sS]" (test case 1)