#P2082. 区间覆盖(加强版)
区间覆盖(加强版)
Description
Given intervals, each with range , compute the total length of the union of these intervals.
Input Format
The first line contains a positive integer , representing the number of intervals. Then lines follow, each containing two positive integers, representing and .
Output Format
Output one line with a single positive integer, which is the total length of the union after covering the intervals.
3
1 100000
200001 1000000
100000000 100000001
900002
Hint
For of the testdata, , . For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号