| OCPC 2025 Summer, Day 2: KIT Contest |
|---|
| Finished |
There are $$$n$$$ cities arranged on the border of a circle in cyclic order from $$$1$$$ to $$$n$$$. Neighboring cities are connected by a street; that is, for each $$$i$$$ from $$$1$$$ to $$$n-1$$$, $$$i$$$ is connected with $$$i+1$$$, and there is a street connecting $$$1$$$ and $$$n$$$. There are also $$$m$$$ additional streets connecting two cities in a straight line. No two streets intersect outside the cities.
Due to previous mismanagement of funds, all streets are in dire need of repairs. You are to hire some construction companies to repair every street.
You can hire a construction company to repair a subset of all streets. Each construction company has certain conditions for the streets they repair. Suppose there are two cities $$$u$$$ and $$$v$$$ that are endpoints of (possibly different) streets they repair. Then, if there is a street connecting $$$u$$$ and $$$v$$$, they also need to be hired to repair this street $$$uv$$$. Furthermore, there must not be any cycle in the streets they repair, as workers may get lost and keep repairing the same streets. Note that the streets one construction company repairs do not have to be connected.
As you should not waste any money, no street should be repaired more than once. How many construction companies do you have to hire at least?
The input consists of:
No two streets connect the same pair of cities.
Output one integer, the minimum number of construction companies you have to hire.
6 15 2
2
3 0
3
10 31 44 94 7
2
Consider the first sample. The following picture visualizes the input and shows a valid way to assign streets to companies (company 1 is red and company 2 is blue).
The following picture shows an invalid way to assign companies:
| Name |
|---|


