QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#808029#9874. Matrix ConstructionlffanWA 0ms3652kbC++14488b2024-12-10 16:27:402024-12-10 16:27:49

Judging History

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

  • [2024-12-10 16:27:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-12-10 16:27:40]
  • 提交

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(n%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: 3652kb

input:

2
1 1
2 3

output:

yes
1 
yes
1 2 3 
4 5 6 

result:

wrong answer Duplicate sum found for adjacent elements at (1,2) and (1,3) (test case 2)