QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#807316#9874. Matrix ConstructionWzy#WA 1ms3600kbC++141.1kb2024-12-09 21:22:282024-12-09 21:22:29

Judging History

你现在查看的是最新测评结果

  • [2024-12-09 21:22:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2024-12-09 21:22:28]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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)