UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#194562#3409. 花菖蒲 FAT1008ms1192kbC++11697b2023-10-15 18:29:432023-10-15 18:59:00

answer

#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	if (!b) {
		if (!a) return puts("1"), 0;
		if (a == 1 || a == 3) return puts("0"), 0;
		if (a == 2) return puts("2\n1 2"), 0;
		printf("%d\n", a + 1);
		for (int i = 1; i <= a; i++) printf("1 %d\n", i + 1);
	} else {
		if (a < b + 2 || a == b + 3) return puts("0"), 0;
		printf("%d\n", a + b + (a > b + 2));
		for (int i = 1; i < b; i++) printf("%d %d\n", i, i + 1);
		for (int i = 1; i <= b; i++) printf("%d %d\n", i, b + i);
		printf("1 %d\n%d %d\n", 2 * b + 1, b, 2 * b + 2);
		if (a > b + 2)
			for (int i = 2 * b + 3; i <= a + b + 1; i++) printf("%d %d\n", 2 * b + 2, i);
	}
} 

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 0ms
memory: 1172kb

input:

0 0

output:

1

result:

ok has solution

Test #2:

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

input:

0 0

output:

1

result:

ok has solution

Test #3:

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

input:

3 1

output:

4
1 2
1 3
1 4

result:

ok has solution

Test #4:

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

input:

3 2

output:

0

result:

ok no solution

Test #5:

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

input:

2 5

output:

0

result:

ok no solution

Test #6:

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

input:

5 0

output:

6
1 2
1 3
1 4
1 5
1 6

result:

ok has solution

Test #7:

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

input:

2 5

output:

0

result:

ok no solution

Test #8:

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

input:

3 4

output:

0

result:

ok no solution

Test #9:

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

input:

5 1

output:

7
1 2
1 3
1 4
4 5
4 6
4 7

result:

ok has solution

Test #10:

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

input:

3 0

output:

0

result:

ok no solution

Test #11:

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

input:

0 0

output:

1

result:

ok has solution

Test #12:

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

input:

1 0

output:

0

result:

ok no solution

Test #13:

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

input:

4 2

output:

6
1 2
1 3
2 4
1 5
2 6

result:

ok has solution

Test #14:

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

input:

0 3

output:

0

result:

ok no solution

Test #15:

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

input:

1 4

output:

0

result:

ok no solution

Subtask #2:

score: 20
Accepted

Test #16:

score: 20
Accepted
time: 0ms
memory: 1176kb

input:

0 0

output:

1

result:

ok has solution

Test #17:

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

input:

0 0

output:

1

result:

ok has solution

Test #18:

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

input:

0 0

output:

1

result:

ok has solution

Test #19:

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

input:

0 0

output:

1

result:

ok has solution

Test #20:

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

input:

0 0

output:

1

result:

ok has solution

Test #21:

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

input:

0 0

output:

1

result:

ok has solution

Test #22:

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

input:

0 0

output:

1

result:

ok has solution

Test #23:

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

input:

58 0

output:

59
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
...

result:

ok has solution

Test #24:

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

input:

85 0

output:

86
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
...

result:

ok has solution

Test #25:

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

input:

0 0

output:

1

result:

ok has solution

Test #26:

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

input:

90 0

output:

91
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
...

result:

ok has solution

Test #27:

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

input:

5 0

output:

6
1 2
1 3
1 4
1 5
1 6

result:

ok has solution

Test #28:

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

input:

0 0

output:

1

result:

ok has solution

Test #29:

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

input:

70 0

output:

71
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
...

result:

ok has solution

Test #30:

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

input:

0 0

output:

1

result:

ok has solution

Subtask #3:

score: 20
Accepted

Test #31:

score: 20
Accepted
time: 0ms
memory: 1188kb

input:

112 110

output:

222
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #32:

score: 0
Accepted
time: 2ms
memory: 1184kb

input:

161 159

output:

320
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #33:

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

input:

26 24

output:

50
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
...

result:

ok has solution

Test #34:

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

input:

82 80

output:

162
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #35:

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

input:

2 0

output:

2
1 2

result:

ok has solution

Test #36:

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

input:

82 80

output:

162
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #37:

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

input:

172 170

output:

342
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #38:

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

input:

93 91

output:

184
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #39:

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

input:

146 144

output:

290
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #40:

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

input:

72 70

output:

142
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #41:

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

input:

23 21

output:

44
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
...

result:

ok has solution

Test #42:

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

input:

77 75

output:

152
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #43:

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

input:

117 115

output:

232
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #44:

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

input:

166 164

output:

330
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #45:

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

input:

119 117

output:

236
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Subtask #4:

score: 30
Accepted

Test #46:

score: 30
Accepted
time: 0ms
memory: 1184kb

input:

25 1

output:

27
1 2
1 3
1 4
4 5
4 6
4 7
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
4 16
4 17
4 18
4 19
4 20
4 21
4 22
...

result:

ok has solution

Test #47:

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

input:

174 170

output:

345
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #48:

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

input:

162 161

output:

0

result:

ok no solution

Test #49:

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

input:

1 1

output:

0

result:

ok no solution

Test #50:

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

input:

1 152

output:

0

result:

ok no solution

Test #51:

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

input:

174 173

output:

0

result:

ok no solution

Test #52:

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

input:

173 164

output:

338
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #53:

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

input:

73 71

output:

144
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #54:

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

input:

72 70

output:

142
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #55:

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

input:

17 33

output:

0

result:

ok no solution

Test #56:

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

input:

192 45

output:

238
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #57:

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

input:

75 158

output:

0

result:

ok no solution

Test #58:

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

input:

22 87

output:

0

result:

ok no solution

Test #59:

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

input:

163 160

output:

0

result:

ok no solution

Test #60:

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

input:

147 143

output:

291
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Subtask #5:

score: 10
Accepted

Test #61:

score: 10
Accepted
time: 0ms
memory: 1176kb

input:

0 0

output:

1

result:

ok has solution

Test #62:

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

input:

48 46

output:

94
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
...

result:

ok has solution

Test #63:

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

input:

117 116

output:

0

result:

ok no solution

Test #64:

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

input:

40 36

output:

77
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
...

result:

ok has solution

Test #65:

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

input:

84 47

output:

132
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #66:

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

input:

0 195

output:

0

result:

ok no solution

Test #67:

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

input:

43 39

output:

83
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
...

result:

ok has solution

Test #68:

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

input:

0 0

output:

1

result:

ok has solution

Test #69:

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

input:

0 21

output:

0

result:

ok no solution

Test #70:

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

input:

0 8

output:

0

result:

ok no solution

Test #71:

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

input:

56 55

output:

0

result:

ok no solution

Test #72:

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

input:

105 102

output:

0

result:

ok no solution

Test #73:

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

input:

146 144

output:

290
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Test #74:

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

input:

0 28

output:

0

result:

ok no solution

Test #75:

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

input:

161 35

output:

197
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20...

result:

ok has solution

Extra Test:

score: 0
Extra Test Passed