QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371401#6743. water235liutaowoaini#WA 1ms3652kbC++171.3kb2024-03-30 10:40:482024-03-30 10:40:50

Judging History

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

  • [2024-03-30 10:40:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3652kb
  • [2024-03-30 10:40:48]
  • 提交

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]