ARC106C - Solutions
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Problem Statement
Two segments [L1:R1] and [L2:R2] are said to intersect when L1≤R2 and L2≤R1 holds.
Consider the following problem P:
Input: N segments [L1:R1],⋯,[LN:RN] L1,L2,⋯,LN,R1,R2,⋯,RN are pairwise distinct. Output: the maximum number of segments that can be chosen so that no two of them intersect.
Takahashi has implemented a program that works as follows:
Sort the given segments in the increasing order of Ri and let the result be [Lp1:Rp1],[Lp2:Rp2],⋯,[LpN:RpN]. For each i=1,2,⋯,N, do the following: Choose [Lpi:Rpi] if it intersects with none of the segments chosen so far. Print the number of chosen segments.
Aoki, on the other hand, has implemented a program that works as follows:
Sort the given segments in the increasing order of Li and let the result be [Lp1:Rp1],[Lp2:Rp2],⋯,[LpN:RpN]. For each i=1,2,⋯,N, do the following: Choose [Lpi:Rpi] if it intersects with none of the segments chosen so far. Print the number of chosen segments.
Given are integers N and M. Construct an input for the problem P, consisting of N segments, such that the following holds:
(The value printed by Takahashi’s program)−(The value printed by Aoki’s program)=M
Sample Input 1
5 1
Sample Output 1
1 10
8 12
13 20
11 14
2 4
Sample Input 2
10 -10
Sample Output 2
-1
ARC106
- Status
- Done
- Rule
- IOI
- Problem
- 6
- Start at
- 2023-7-5 8:15
- End at
- 2023-7-5 10:15
- Duration
- 2 hour(s)
- Host
- Partic.
- 13