QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297892#6309. AqrePlentyOfPenalty#WA 0ms3736kbC++20563b2024-01-05 12:59:102024-01-05 12:59:10

Judging History

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

  • [2024-01-05 12:59:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3736kb
  • [2024-01-05 12:59:10]
  • 提交

answer

#include<bits/stdc++.h>
#define all(x) begin(x),end(x)
using namespace std;
const int N=1e3+9;
int T,n,m,num[5],mn,mi;
int main(){
#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
#endif
	cin.tie(0)->sync_with_stdio(0);
	cin>>T;
	while(T--){
		cin>>n>>m;
		for(int i=0;i<4;++i)num[i]=0;
		for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)++num[i+j&3];
		mn=n*m,mi=2;
		for(int i=0;i<4;++i)if(num[i]<mn)mn=num[i],mi=i;
		printf("%d\n",n*m-mn);
		for(int i=1;i<=n;++i){
			for(int j=1;j<=m;++j)putchar('0'+((i+j&3)!=mi));
			putchar('\n');
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3736kb

input:

3
2 2
3 4
3 8

output:

4
11
11
9
1101
1011
0111
18
11011101
10111011
01110111

result:

wrong answer 1s are not connected. (test case 2)