PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000270. Diện tích phủ ít nhất K hình (Area Covered at Least K Times)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Diện tích phủ ít nhất K hình (Area Covered at Least K Times)
Area Covered at Least K Times
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given axis-aligned rectangles, each covering , find the area covered by at least rectangles. Identical rectangles count separately; boundaries have zero area.
Input
First line: . Next lines: .
Output
Print the required area.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; ; .
- Subtask 3 (50 points): ; ; .
Example 1
Input
2 2
0 0 3 2
1 1 4 3
Output
2
Explanation
The intersection is , with area 2.
Example 2
Input
2 1
0 0 2 2
2 0 4 2
Output
8
Explanation
The rectangles only touch at an edge, so the area is .