QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#759674#6743. water235ship2077AC ✓22ms3904kbC++23680b2024-11-18 11:10:082024-11-18 11:10:08

Judging History

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

  • [2024-11-18 11:10:08]
  • 评测
  • 测评结果:AC
  • 用时:22ms
  • 内存:3904kb
  • [2024-11-18 11:10:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int read(){
	int x=0;char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x;
}
int main(){
	int n=read(),m=read();
	if (n%2==0&&m%2==0){
		printf("%d\n",n+m>>1);
	for (int i=1;i<=n;puts(""),i++)
		for (int j=1;j<=m;j++)
			if (i==1&&j%2==0) printf("1 ");
			else if (j==1&&i%2==0) printf("1 ");
			else printf("0 ");
		return 0;
	}
	printf("%d\n",(n>>1)+(m>>1)+1);
	for (int i=1;i<=n;puts(""),i++)
		for (int j=1;j<=m;j++)
			if (i==1&&(j%2==1||j==m)) printf("1 ");
			else if (j==1&&(i%2==1||i==n)) printf("1 ");
			else printf("0 ");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

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

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: 3712kb

input:

1 4

output:

3
1 0 1 1 

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

2
0 1 
1 0 

result:

ok The answer is correct.

Test #5:

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

input:

2 4

output:

3
0 1 0 1 
1 0 0 0 

result:

ok The answer is correct.

Test #6:

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

input:

4 3

output:

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

result:

ok The answer is correct.

Test #7:

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

input:

4 4

output:

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

result:

ok The answer is correct.

Test #8:

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

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: 3772kb

input:

2 444

output:

223
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 #10:

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

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: 3728kb

input:

3 333

output:

168
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #12:

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

input:

3 332

output:

168
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #13:

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

input:

224 4

output:

114
0 1 0 1 
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 ...

result:

ok The answer is correct.

Test #14:

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

input:

31 31

output:

31
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 
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 #15:

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

input:

31 30

output:

31
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 
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...

result:

ok The answer is correct.

Test #16:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

128 128

output:

128
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 
1 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: 18ms
memory: 3728kb

input:

1000 1000

output:

1000
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 #18:

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

input:

1 1

output:

1
1 

result:

ok The answer is correct.

Test #19:

score: 0
Accepted
time: 18ms
memory: 3844kb

input:

999 999

output:

999
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #20:

score: 0
Accepted
time: 18ms
memory: 3776kb

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: 18ms
memory: 3900kb

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: 14ms
memory: 3776kb

input:

10 99998

output:

50004
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #23:

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

input:

100 10000

output:

5050
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 #24:

score: 0
Accepted
time: 18ms
memory: 3772kb

input:

99 9999

output:

5049
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #25:

score: 0
Accepted
time: 18ms
memory: 3768kb

input:

9998 99

output:

5049
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 ...

result:

ok The answer is correct.

Test #26:

score: 0
Accepted
time: 13ms
memory: 3700kb

input:

1000 999

output:

1000
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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 #27:

score: 0
Accepted
time: 22ms
memory: 3904kb

input:

488889 2

output:

244446
1 1 
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...

result:

ok The answer is correct.

Test #28:

score: 0
Accepted
time: 14ms
memory: 3728kb

input:

31112 31

output:

15572
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 
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 ...

result:

ok The answer is correct.

Test #29:

score: 0
Accepted
time: 17ms
memory: 3724kb

input:

3111 310

output:

1711
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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.