Canadian Computing Olympiad: 2021 Day 2, Problem 3
Some cities have complicated road networks that require advanced graph theory
to analyze.
But not Loop Town!
Loop Town has a single circular road that loops around the town.
It has
The road in Loop Town has length
Every morning, all
However, a pandemic has now come to Loop Town, disrupting this usual routine. To prevent the spread of disease, residents must now observe social distancing while walking to work. Since the loop road is rather narrow, this means that it is far more inconvenient for two people to cross each other on their way to work (one person must temporarily step off the path to let the other pass). What is the minimum total number of crossings, assuming all the residents work together to achieve this?
Input Specification
The first line contains the two integers
The
For 12 of the 25 available marks,
For an additional 6 of the 25 available marks,
Output Specification
On a single line, output the minimum total number of crossings.
Sample Input 1
3 100
10 50
30 20
60 40
Sample Output 1
0
Explanation for Sample Output 1
Since the road is circular, nobody needs to cross each other.
Sample Input 2
4 100
30 70
10 12
60 75
90 50
Sample Output 2
1
Comments
This comment is hidden due to too much negative feedback. Show it anyway.