QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#585345 | #9114. Black or White 2 | yhddd | WA | 0ms | 3800kb | C++20 | 1.1kb | 2024-09-23 20:27:38 | 2024-09-23 20:27:39 |
Judging History
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();
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;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++)printf("%lld ",ans[i][j]);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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3800kb
input:
2 2 2 2 2 3 0
output:
1 0 0 1 0 0 0 0 0 0
result:
wrong answer