| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 51 | 19 | 15 | 62.500% |
The fanciest hall of Prince Ville’s new castle has a rectangular floor. The walls of the hall run from North to South and from East to West. Ville’s advisors have proposed to cover some parts of the floor with carpets and even suggested a specific arrangement of them.
Ville, caring mostly only about the quantitative aspect of the deal, would like to know the total area covered by the carpets in the proposed arrangement.
The first line of input contains three space-separated integers: the number of carpets $K$ (1ドル ≤ K ≤ 3$), the distance $L$ from the East wall to the West wall (1ドル ≤ L ≤ 10^6$), and the distance $P$ from the North wall to the South wall (1ドル ≤ P ≤ 10^6$) of the hall. Each of the following $K$ lines contains four space-separated integers $N,ドル $S,ドル $E,ドル and $W$ describing one carpet. The edges of the carpet are parallel to the walls and the numbers $N,ドル $S,ドル $E,ドル and $W$ show, respectively, the distance of the North, South, East, and West edge of the carpet from the corresponding wall. The carpets may overlap partially or fully. All distances are given in metres.
The only line of output should contain a single integer $S,ドル the total area of the floor covered by carpets, in square metres.
2 8 9 3 3 3 0 5 1 2 4
20
3 5 5 3 1 1 3 1 3 3 1 3 1 3 1
3