PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SRD0000081. Câu lạc bộ hình học ẩn danh (Geometers Anonymous Club)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Câu lạc bộ hình học ẩn danh (Geometers Anonymous Club)
Geometers Anonymous Club
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given convex polygons with vertices listed counterclockwise, output the number of vertices of their Minkowski sum for each interval . The Minkowski sum is the set . Each polygon has at least three vertices and no three consecutive vertices are collinear.
Input
Read polygons; for polygon , read and then its CCW vertex coordinates. Then read and its intervals.
Output
Print the vertex count of the Minkowski sum for each query.
Subtasks
- Subtask 1 (10 points): , . ; ; ; đa giác lồi nghiêm ngặt, CCW; .
- Subtask 2 (20 points): , . ; ; ; đa giác lồi nghiêm ngặt, CCW; .
- Subtask 3 (25 points): , . ; ; ; đa giác lồi nghiêm ngặt, CCW; .
- Subtask 4 (45 points): , . ; ; ; đa giác lồi nghiêm ngặt, CCW; .
Examples
Input
3
3
0 0
1 0
0 1
4
1 1
1 2
0 2
0 1
3
2 2
1 2
2 1
3
1 2
2 3
1 3
Output
5
5
6
Explanation
The first two polygons have five distinct edge directions altogether, so their Minkowski sum has five vertices. The last two also yield five, while all three together yield six.