QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371401 | #6743. water235 | liutaowoaini# | WA | 1ms | 3652kb | C++17 | 1.3kb | 2024-03-30 10:40:48 | 2024-03-30 10:40:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int ans = n / 2 + 1 + m / 2;
if (n == 1 && m == 1)
{
cout << 1 << endl;
cout << 1 << endl;
return 0;
}
if (n == 2&&m==2)
{
cout << 2 << endl;
cout << 1 << 0 << endl;
cout << 0 << 1 << endl;
return 0;
}
if (m == 2)
{
if (n == 1)
{
cout << 2 << endl;
cout << 1 << 1 << endl;
return 0;
}
else
{
int ans = 2 + (n - 1) / 2;
cout << ans << endl;
cout << 1<<0 << endl;
cout << 0<<1 << endl;
for (int i = 3; i <= n; i++)
{
if (i == n && i & 1)
{
cout << 10 << endl;
continue;
}
for (int j = 1; j <= m; j++)
{
if (i % 2 == 0 && j == 1) cout << 1<<' ';
else cout << 0<<' ';
}
cout << endl;
}
}
return 0;
}
cout << ans << endl;
for (int i = 1; i <= m; i++)
{
if (i == m)
{
cout << 1 << endl;
continue;
}
if (i & 1) cout << 1<<' ';
else cout << 0<<' ';
}
for (int i = 2; i <= n; i++)
{
if (i == n && i % 2 == 0)
{
for (int j = 1; j <= m; j++)
{
if (j == 1) cout << 1<<' ';
else cout << 0<<' ';
}
cout << endl;
continue;
}
for (int j = 1; j <= m; j++)
{
if (i & 1 && j == 1) cout << 1<<' ';
else cout << 0<<' ';
}
cout << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3544kb
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: 1ms
memory: 3652kb
input:
1 4
output:
3 1 0 1 1
result:
ok The answer is correct.
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3632kb
input:
2 2
output:
2 10 01
result:
wrong answer Integer 10 violates the range [0, 1]