문제
Farmer John's
The fence consists of
Each cow has a preferred starting and ending position for her daily walk, each being points somewhere along the fence (possibly at posts, possibly not). Each cow walks along the fence for her daily walks, starting from her starting position and ending at her ending position. There are two routes that the cow could take, given that the fence forms a closed loop. Since cows are somewhat lazy creatures, each cow will walk in the direction around the fence that is shorter. Remarkably, this choice is always clear -- there are no ties!
A cow touches a fence post if she walks past it, or if the fence post is the starting or ending point of her walk. Please help FJ calculate the number of daily touches experienced by each fence post, so he knows which post to repaint next.
It can be shown that there is exactly one possibility for the fences given the locations of all of the posts.
입력
The first line of input contains
출력
Write
부분문제
| 번호 | 점수 | 조건 |
|---|---|---|
| #1 | 20점 | |
| #2 | 30점 | All locations satisfy |
| #3 | 50점 | 추가 제약 조건 없음 |
예제 #1
5 4
3 1
1 5
3 5
1 1
2 1 1 5
1 5 3 4
3 1 3 5
2 1 2 1
3 2 3 3
1
2
2
1
The following posts are connected by fence segments:
The posts touched by each cow are as follows:
Posts
2 and4 .Posts
2 and3 .Posts
1 and3 .No posts.
No posts.
예제 #2
2 8
1 1
1 2
0 2
0 3
0 0
0 1
2 3
2 0
1 1 2 1
1 0 1 3
1
0
0
0
1
1
1
2
예제 #3
1 12
0 0
2 0
2 1
1 1
1 2
3 2
3 3
1 3
1 4
2 4
2 5
0 5
2 2 0 2
1
1
1
1
1
0
0
0
0
0
0
0