QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#808033 | #9874. Matrix Construction | lffan | WA | 0ms | 3724kb | C++14 | 488b | 2024-12-10 16:30:10 | 2024-12-10 16:30:21 |
Judging History
answer
#include<iostream>
using namespace std;
int main(){
int T;
cin>>T;
int n,m;
while(T--){
cin>>n>>m;
int total = m*n;
cout<<"yes"<<"\n";
if(m%2==0){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<i*m+j+1<<" ";
}
cout<<"\n";
}
}
else{
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i%2==0)
cout<<i*n+j*2+1<<" ";
else
cout<<i*n+j*2+2<<" ";
}
cout<<"\n";
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3724kb
input:
2 1 1 2 3
output:
yes 1 yes 1 3 5 4 6 8
result:
wrong answer Integer parameter [name=a[2][3]] equals to 8, violates the range [1, 6] (test case 2)