Educational Round #10 — Editorial
"Theodore Roosevelt" — the flagship of the Kukuland fleet. The sworn enemies of Kukuland, the Flat-Earthers, decided to destroy it. They learned that "Theodore Roosevelt" is represented by a convex polygon with vertices, and the coordinates of all its vertices are known to them. Then they launched ballistic missiles and recorded the coordinates of their explosion points. According to the calculations of the Flat-Earthers' headquarters, "Theodore Roosevelt" will be destroyed if at least missiles hit it. Determine whether the Flat-Earthers managed to destroy the ship.
Input. The first line contains integers and k~(3 \le n \le 10^5, 0 \le k \le m \le 10^5). The next lines contain the coordinates of the polygon vertices in counterclockwise order. The following lines contain the coordinates of the explosion points. All coordinates are integers with absolute values not exceeding 10^9.
Output. Print "YES" if at least points lie inside the polygon, and "NO" otherwise.
5 4 2
1 -1
1 2
0 4
-1 2
-1 -1
-2 -1
1 -1
0 1
2 3YESFarmer John has arrived in the city with his cows! During sunset, the cows look at the city skyline and observe beautiful silhouettes formed by rectangular buildings.
The entire skyline is represented by a number line with buildings. The silhouette of the -th building extends along the horizon between points a_i and b_i and has height h_i. Determine the total area (in square units) of the silhouette formed by all buildings.
Input. The first line contains an integer n~(1 \le n \le 40000). Each of the next lines describes the -th building with three integers: a_i, b_i~(1 \le a_i < b_i \le 10^9) and h_i~(1 \le h_i \le 10^9).
Output. Print the total area of the city skyline (in square units) formed by all buildings.

4
2 5 1
9 10 4
6 8 2
4 6 316
Şərhlər