#P10695. [SNCPC2024] 商路
[SNCPC2024] 商路
Problem Description
A circle is divided into equal parts by points, numbered clockwise as . Among them, points each have a market built on them.
A trade route starting from market and aiming at market is a directed line segment (), and it must satisfy the following conditions:
- Market must be the farthest market from market (if there are multiple farthest markets at the same distance, any one of them is allowed).
- The trade route segment must not intersect or overlap with any other trade route segment at any place other than their starting points or ending points.
What is the maximum number of trade routes that can exist?
Input Format
The first line contains two integers (), separated by spaces, meaning that markets are placed on the equally divided points on the circle.
The second line contains integers (), which are the indices of the points where markets are built.
Output Format
Output one integer, the maximum number of trade routes that can exist.
10 5
1 2 5 6 8
2
3 3
1 2 3
3
Hint
For the first sample, two possible answers are shown in the figures below:


Translated by ChatGPT 5