QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#483188#6743. water235ucup-team052#AC ✓59ms29828kbC++14553b2024-07-18 13:04:532024-07-18 13:04:53

Judging History

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

  • [2024-07-18 13:04:53]
  • 评测
  • 测评结果:AC
  • 用时:59ms
  • 内存:29828kb
  • [2024-07-18 13:04:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int n, m;

int main() {
	scanf("%d%d", &n, &m);
	vector < vector <int> > ans(n, vector <int> (m));
	int x = 0, y = 0, res = 1; ans[x][y] = 1;
	while (x + 2 < n) {
		x += 2; ++res; ans[x][y] = 1;
	}
	while (y + 2 < m) {
		y += 2; ++res; ans[x][y] = 1;
	}
	if (x != n - 1 || y != m - 1) {
		ans[n - 1][m - 1] = 1; ++res;
	}
	printf("%d\n", res);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			printf("%d%c", ans[i][j], j == m - 1 ? '\n' : ' ');
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3752kb

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

3 3

output:

3
1 0 0
0 0 0
1 0 1

result:

ok The answer is correct.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

1 4

output:

3
1 0 1 1

result:

ok The answer is correct.

Test #4:

score: 0
Accepted
time: 0ms
memory: 4088kb

input:

2 2

output:

2
1 0
0 1

result:

ok The answer is correct.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

2 4

output:

3
1 0 1 0
0 0 0 1

result:

ok The answer is correct.

Test #6:

score: 0
Accepted
time: 0ms
memory: 4092kb

input:

4 3

output:

4
1 0 0
0 0 0
1 0 1
0 0 1

result:

ok The answer is correct.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

4 4

output:

4
1 0 0 0
0 0 0 0
1 0 1 0
0 0 0 1

result:

ok The answer is correct.

Test #8:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

1 789

output:

395
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...

result:

ok The answer is correct.

Test #9:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

2 444

output:

223
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...

result:

ok The answer is correct.

Test #10:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

2 445

output:

224
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ...

result:

ok The answer is correct.

Test #11:

score: 0
Accepted
time: 0ms
memory: 4092kb

input:

3 333

output:

168
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #12:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

3 332

output:

168
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #13:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

224 4

output:

114
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
1 0 0 0
...

result:

ok The answer is correct.

Test #14:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

31 31

output:

31
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #15:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

31 30

output:

31
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #16:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

128 128

output:

128
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #17:

score: 0
Accepted
time: 41ms
memory: 7752kb

input:

1000 1000

output:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #18:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

1 1

output:

1
1

result:

ok The answer is correct.

Test #19:

score: 0
Accepted
time: 42ms
memory: 7692kb

input:

999 999

output:

999
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #20:

score: 0
Accepted
time: 39ms
memory: 8900kb

input:

2 499999

output:

250001
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...

result:

ok The answer is correct.

Test #21:

score: 0
Accepted
time: 43ms
memory: 10948kb

input:

1 999999

output:

500000
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1...

result:

ok The answer is correct.

Test #22:

score: 0
Accepted
time: 42ms
memory: 7276kb

input:

10 99998

output:

50004
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #23:

score: 0
Accepted
time: 41ms
memory: 7280kb

input:

100 10000

output:

5050
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #24:

score: 0
Accepted
time: 41ms
memory: 7048kb

input:

99 9999

output:

5049
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #25:

score: 0
Accepted
time: 46ms
memory: 7940kb

input:

9998 99

output:

5049
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #26:

score: 0
Accepted
time: 45ms
memory: 7756kb

input:

1000 999

output:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.

Test #27:

score: 0
Accepted
time: 59ms
memory: 29828kb

input:

488889 2

output:

244446
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0 0
1 0
0...

result:

ok The answer is correct.

Test #28:

score: 0
Accepted
time: 46ms
memory: 8596kb

input:

31112 31

output:

15572
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok The answer is correct.

Test #29:

score: 0
Accepted
time: 45ms
memory: 7924kb

input:

3111 310

output:

1711
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok The answer is correct.