QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#285412#5438. Half Mixedushg8877#WA 1ms3512kbC++14793b2023-12-16 18:59:122023-12-16 18:59:13

Judging History

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

  • [2023-12-16 18:59:13]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3512kb
  • [2023-12-16 18:59:12]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
const int MAXN=1e6+5;
bool flag[MAXN];
void solve(){
	ll n,m;cin>>n>>m;
	if((n*(n+1)/2&1)&&(m*(m+1)/2&1)){cout<<"No"<<endl;return;}
	cout<<"Yes"<<endl;
	if(n*(n+1)%4==0){
		ll k=n*(n+1)/4;
		for(int i=1,lst=0,op=0;i<=n;i++){
			if(lst+1+n-i<=k) lst++,k-=lst;
			else op^=1,lst=1,k--;
			for(int j=1;j<=m;j++) cout<<op;
			cout<<endl;
		}
	}else{
		ll k=m*(m+1)/4;
		for(int i=1,lst=0,op=0;i<=m;i++){
			if(lst+1+m-i<=k) lst++,k-=lst;
			else op^=1,lst=1,k--;
			flag[i]=op;
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++) cout<<flag[j];
			cout<<endl;
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	int _;cin>>_;
	while(_--) solve();
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3512kb

input:

2
2 3
1 1

output:

Yes
010
010
No

result:

wrong output format Expected integer, but "010" found (test case 1)