QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#808033#9874. Matrix ConstructionlffanWA 0ms3724kbC++14488b2024-12-10 16:30:102024-12-10 16:30:21

Judging History

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

  • [2024-12-10 16:30:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3724kb
  • [2024-12-10 16:30:10]
  • 提交

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

详细

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)