QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#585376#9114. Black or White 2yhdddWA 153ms3960kbC++201.2kb2024-09-23 20:33:182024-09-23 20:33:19

Judging History

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

  • [2024-09-23 20:33:19]
  • 评测
  • 测评结果:WA
  • 用时:153ms
  • 内存:3960kb
  • [2024-09-23 20:33:18]
  • 提交

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;
	if(k>=n*m-k)k=n*m-k,fl=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){
		if(!ans[n][m])ans[n][m]=1;
		else ans[n][m-1]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++)printf("%lld",ans[i][j]^fl);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: 3960kb

input:

2
2 2 2
2 3 0

output:

01
10
000
000

result:

ok Output is valid. OK.

Test #2:

score: -100
Wrong Answer
time: 153ms
memory: 3816kb

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
01
10
01
11
11
11
000
000
100
000
101
000
010
110
010
111
011
111
111
111
00
00
00
10
00
00
10
00
01
00
10
11
01
11
10
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.