UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#194475#3409. 花菖蒲 WilliamFranklin1007ms1252kbC++11888b2023-10-15 15:02:272023-10-15 18:48:01

answer

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp(Tx, Ty) make_pair(Tx, Ty)
#define For(Ti, Ta, Tb) for(auto Ti = (Ta); Ti <= (Tb); Ti++)
#define Dec(Ti, Ta, Tb) for(auto Ti = (Ta); Ti >= (Tb); Ti--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	if (a == 0 && b == 0) cout << 1 << endl; 
	else if (b > a - 2 || a - b == 3) cout << 0 << endl;
	else {
		cout << b + a + 1 << endl;
		cout << 1 << ' ' << 2 << endl;
		cout << 1 << ' ' << 3 << endl;
		int cnt = 3;
		for (int i = 1; i <= b; i++) {
			cout << cnt - 1 << ' ' << cnt + 1 << endl;
			cout << cnt - 1 << ' ' << cnt + 2 << endl;
			cnt += 2;
		}
		for (int i = b + 3; i <= a; i++) {
			cout << 1 << ' ' << ++cnt << endl;
		}
	}
	return 0;
}

详细

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

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

0 0

output:

1

result:

ok has solution

Test #2:

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

input:

0 0

output:

1

result:

ok has solution

Test #3:

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

input:

3 1

output:

5
1 2
1 3
2 4
2 5

result:

ok has solution

Test #4:

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

input:

3 2

output:

0

result:

ok no solution

Test #5:

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

input:

2 5

output:

0

result:

ok no solution

Test #6:

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

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

input:

2 5

output:

0

result:

ok no solution

Test #8:

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

input:

3 4

output:

0

result:

ok no solution

Test #9:

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

input:

5 1

output:

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

result:

ok has solution

Test #10:

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

input:

3 0

output:

0

result:

ok no solution

Test #11:

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

input:

0 0

output:

1

result:

ok has solution

Test #12:

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

input:

1 0

output:

0

result:

ok no solution

Test #13:

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

input:

4 2

output:

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

result:

ok has solution

Test #14:

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

input:

0 3

output:

0

result:

ok no solution

Test #15:

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

input:

1 4

output:

0

result:

ok no solution

Subtask #2:

score: 20
Accepted

Test #16:

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

input:

0 0

output:

1

result:

ok has solution

Test #17:

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

input:

0 0

output:

1

result:

ok has solution

Test #18:

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

input:

0 0

output:

1

result:

ok has solution

Test #19:

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

input:

0 0

output:

1

result:

ok has solution

Test #20:

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

input:

0 0

output:

1

result:

ok has solution

Test #21:

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

input:

0 0

output:

1

result:

ok has solution

Test #22:

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

input:

0 0

output:

1

result:

ok has solution

Test #23:

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

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: 0ms
memory: 1252kb

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

input:

0 0

output:

1

result:

ok has solution

Test #26:

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

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

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

input:

0 0

output:

1

result:

ok has solution

Test #29:

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

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

input:

0 0

output:

1

result:

ok has solution

Subtask #3:

score: 20
Accepted

Test #31:

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

input:

112 110

output:

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

result:

ok has solution

Test #32:

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

input:

161 159

output:

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

result:

ok has solution

Test #33:

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

input:

26 24

output:

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

result:

ok has solution

Test #34:

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

input:

82 80

output:

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

result:

ok has solution

Test #35:

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

input:

2 0

output:

3
1 2
1 3

result:

ok has solution

Test #36:

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

input:

82 80

output:

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

result:

ok has solution

Test #37:

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

input:

172 170

output:

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

result:

ok has solution

Test #38:

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

input:

93 91

output:

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

result:

ok has solution

Test #39:

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

input:

146 144

output:

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

result:

ok has solution

Test #40:

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

input:

72 70

output:

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

result:

ok has solution

Test #41:

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

input:

23 21

output:

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

result:

ok has solution

Test #42:

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

input:

77 75

output:

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

result:

ok has solution

Test #43:

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

input:

117 115

output:

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

result:

ok has solution

Test #44:

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

input:

166 164

output:

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

result:

ok has solution

Test #45:

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

input:

119 117

output:

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

result:

ok has solution

Subtask #4:

score: 30
Accepted

Test #46:

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

input:

25 1

output:

27
1 2
1 3
2 4
2 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 #47:

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

input:

174 170

output:

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

result:

ok has solution

Test #48:

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

input:

162 161

output:

0

result:

ok no solution

Test #49:

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

input:

1 1

output:

0

result:

ok no solution

Test #50:

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

input:

1 152

output:

0

result:

ok no solution

Test #51:

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

input:

174 173

output:

0

result:

ok no solution

Test #52:

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

input:

173 164

output:

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

result:

ok has solution

Test #53:

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

input:

73 71

output:

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

result:

ok has solution

Test #54:

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

input:

72 70

output:

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

result:

ok has solution

Test #55:

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

input:

17 33

output:

0

result:

ok no solution

Test #56:

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

input:

192 45

output:

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

result:

ok has solution

Test #57:

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

input:

75 158

output:

0

result:

ok no solution

Test #58:

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

input:

22 87

output:

0

result:

ok no solution

Test #59:

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

input:

163 160

output:

0

result:

ok no solution

Test #60:

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

input:

147 143

output:

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

result:

ok has solution

Subtask #5:

score: 10
Accepted

Test #61:

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

input:

0 0

output:

1

result:

ok has solution

Test #62:

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

input:

48 46

output:

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

result:

ok has solution

Test #63:

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

input:

117 116

output:

0

result:

ok no solution

Test #64:

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

input:

40 36

output:

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

result:

ok has solution

Test #65:

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

input:

84 47

output:

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

result:

ok has solution

Test #66:

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

input:

0 195

output:

0

result:

ok no solution

Test #67:

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

input:

43 39

output:

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

result:

ok has solution

Test #68:

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

input:

0 0

output:

1

result:

ok has solution

Test #69:

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

input:

0 21

output:

0

result:

ok no solution

Test #70:

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

input:

0 8

output:

0

result:

ok no solution

Test #71:

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

input:

56 55

output:

0

result:

ok no solution

Test #72:

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

input:

105 102

output:

0

result:

ok no solution

Test #73:

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

input:

146 144

output:

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

result:

ok has solution

Test #74:

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

input:

0 28

output:

0

result:

ok no solution

Test #75:

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

input:

161 35

output:

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

result:

ok has solution

Extra Test:

score: 0
Extra Test Passed