QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#585392#9114. Black or White 2yhdddWA 154ms4016kbC++201.3kb2024-09-23 20:36:502024-09-23 20:36:50

Judging History

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

  • [2024-09-23 20:36:50]
  • 评测
  • 测评结果:WA
  • 用时:154ms
  • 内存:4016kb
  • [2024-09-23 20:36:50]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 998244353ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define db double
using namespace std;
const int maxn=1510;
const int inf=1e18;
inline int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch-48);ch=getchar();}
	return x*f;
}
bool Mbe;

int n,m,k;
int ans[maxn][maxn];
void work(){
	n=read();m=read();k=read();
	bool fl=0,fl1=0;
	if(k>n*m-k)k=n*m-k,fl=1;
	if(n>m)swap(n,m),fl1=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)ans[i][j]=0;
	}
	for(int j=1;j<=m;j+=2)if(k)ans[1][j]=1,k--;
	for(int i=2;i<=n;i++){
		for(int j=2-(i&1);j<=m;j+=2){
			if(k>=2)ans[i][j]=ans[i-1][j]=1,k-=2;
		}
	}
	if(k)ans[n][m]=1;
	if(!fl1){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++)printf("%lld",ans[i][j]^fl);puts("");
		}
	}
	else{
		for(int i=1;i<=m;i++){
			for(int j=1;j<=n;j++)printf("%lld",ans[j][i]^fl);puts("");
		}
	}
	// puts("");
}

// \
444

bool Med;
int T;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	
//	cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
	
	T=read();
	while(T--)work();
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3740kb

input:

2
2 2 2
2 3 0

output:

10
01
000
000

result:

ok Output is valid. OK.

Test #2:

score: -100
Wrong Answer
time: 154ms
memory: 4016kb

input:

27520
2 2 0
2 2 1
2 2 2
2 2 3
2 2 4
2 3 0
2 3 1
2 3 2
2 3 3
2 3 4
2 3 5
2 3 6
3 2 0
3 2 1
3 2 2
3 2 3
3 2 4
3 2 5
3 2 6
3 3 0
3 3 1
3 3 2
3 3 3
3 3 4
3 3 5
3 3 6
3 3 7
3 3 8
3 3 9
2 4 0
2 4 1
2 4 2
2 4 3
2 4 4
2 4 5
2 4 6
2 4 7
2 4 8
3 4 0
3 4 1
3 4 2
3 4 3
3 4 4
3 4 5
3 4 6
3 4 7
3 4 8
3 4 9
3 4 10...

output:

00
00
10
00
10
01
01
11
11
11
000
000
100
000
101
000
101
001
010
111
011
111
111
111
00
00
00
10
00
00
10
00
10
10
00
11
01
11
01
01
11
11
11
11
11
000
000
000
100
000
000
101
000
000
101
000
001
111
010
000
000
101
111
010
111
110
010
111
111
011
111
111
111
111
111
0000
0000
1000
0000
1010
0000
1...

result:

wrong answer Output doesn't minimize loss.