QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#190682 | #6743. water235 | lyzqs# | WA | 0ms | 3832kb | C++14 | 1.2kb | 2023-09-29 12:44:31 | 2023-09-29 12:44:32 |
Judging History
answer
#include <bits/stdc++.h>
#define il inline
#define ll long long
#define int ll
#define Max 200005
using namespace std;
il ll read()
{
char c=getchar();
ll x=0,f=1;
while(c>'9'||c<'0')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+c-'0';
c=getchar();
}
return x*f;
}
signed main()
{
int n=read(),m=read();
int ans1=n/2+1+(m)/2,ans2=m/2+1+n/2;
vector<vector<int>> a;
if(ans1<=ans2)
{
cout<<ans1<<"\n";
for(int j=1;j<=m;j++)
{
if(j&1||(m%2==0&&j==m)) printf("1 ");
else printf("0 ");
}
puts("");
for(int i=2;i<=n;i++)
{
if(i&1||(n%2==0&&i==n)) printf("1 ");
else printf("0 ");
for(int j=2;j<=m;j++)
{
printf("0 ");
}
puts("");
}
}
else
{
cout<<ans2<<"\n";
swap(n,m);
a.resize(n+2);
a[1].resize(m+1);
for(int j=1;j<=m;j++)
{
if(j&1||(m%2==0&&j==m)) a[1][j]=1;
else a[1][j]=0;
}
for(int i=2;i<=n;i++)
{
a[i].resize(m+1);
if((n%2==0&&i==n)||i&1) a[i][1]=1;
else a[i][1]=0;
for(int j=2;j<=m;j++)
{
a[i][j]=0;
}
}
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
{
printf("%lld%c",a[j][i]," \n"[j==n]);
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
3 3
output:
3 1 0 1 0 0 0 1 0 0
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 4
output:
3 1 0 1 1
result:
ok The answer is correct.
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3736kb
input:
2 2
output:
3 1 1 1 0
result:
wrong answer The answer is wrong: expected = 2, found = 3