QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#112459 | #6309. Aqre | FHQY | WA | 2ms | 3380kb | C++20 | 1.5kb | 2023-06-11 20:38:48 | 2023-06-11 20:38:50 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define FOR(i,begin,end,delta) for(int i=begin;i<=end;i+=delta)
#define For(i,x) for(auto i:x)
#define fastios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl '\n'
#define rd(x) scanf("%lld",&x)
#define wc(x) putchar(x)
#define ws(x) printf("%s",x)
#define el puts("")
#define udm unordered_map<int,int>
#define inf 0x3f3f3f3f
#define set_inf(a) memset(&a,0x3f,sizeof(a))
#define set_0(a) memset(&a,0,sizeof(a))
#define set_unint(a) memset(&a,-1,sizeof(a))
using namespace std;
//define_var
const int M=2e5+9;
int mp[1009][1009];
//define_var
//function_begin
int read()
{
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
return x*f;
}
void write(int x)
{
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
//function_end
//solve_begin
void solve()
{
int n,m;
cin>>n>>m;
int ans=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
mp[i][j]=0;
}
}
for(int i=1;i<=n;i++)
{
int cnt=0;
for(int j=i;j<i+m;j++)
{
int now=(j-1)%m+1;
if(cnt==3)
cnt=0;
else
{
cnt++;
mp[i][now]=1;
ans++;
}
}
}
cout<<ans<<endl;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cout<<mp[i][j];
if(j!=m)
cout<<" ";
}
cout<<endl;
}
}
//solve_end
//main_begin
signed main()
{
fastios
int T=1;
cin>>T;
while(T--)
solve();
}
//main_end
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3380kb
input:
3 2 2 3 4 3 8
output:
4 1 1 1 1 9 1 1 1 0 0 1 1 1 1 0 1 1 18 1 1 1 0 1 1 1 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1
result:
wrong answer Length must be equal to m (test case 1)