CF1399F Yet Another Segments Subset

Description

You are given $ n $ segments on a coordinate axis $ OX $ . The $ i $ -th segment has borders $ [l_i; r_i] $ . All points $ x $ , for which $ l_i \le x \le r_i $ holds, belong to the $ i $ -th segment. Your task is to choose the maximum by size (the number of segments) subset of the given set of segments such that each pair of segments in this subset either non-intersecting or one of them lies inside the other one. Two segments $ [l_i; r_i] $ and $ [l_j; r_j] $ are non-intersecting if they have no common points. For example, segments $ [1; 2] $ and $ [3; 4] $ , $ [1; 3] $ and $ [5; 5] $ are non-intersecting, while segments $ [1; 2] $ and $ [2; 3] $ , $ [1; 2] $ and $ [2; 2] $ are intersecting. The segment $ [l_i; r_i] $ lies inside the segment $ [l_j; r_j] $ if $ l_j \le l_i $ and $ r_i \le r_j $ . For example, segments $ [2; 2] $ , $ [2, 3] $ , $ [3; 4] $ and $ [2; 4] $ lie inside the segment $ [2; 4] $ , while $ [2; 5] $ and $ [1; 4] $ are not. You have to answer $ t $ independent test cases.

Input Format

N/A

Output Format

N/A