2752Interesting clocks

2752   Interesting clocks

题目描述

An elder man has a row of a total of N interesting clocks, numbered from 1 to N. He can make some consecutive clocks gain 1 second, and also make other clocks lose 1 second. The elder man carried out M operations totally. Finally he wants to know the number of clocks which gains most seconds. 

输入格式:

      There are multiple test case.

      For each test case, the first line contains two integer N and M.

      The next M lines, each line contains two integers L and R1<=L<=R<=N,which The elder man make clocks whose numbers are in [ L,R ] gain 1 second, and make other clocks lose 1 second.

1<=N , M <=100000.

输出格式:

      For each test case, there should be one line in the output.

      You should output Case #x: y”,where x is the case number(starting from 1), and y is the number of clocks which gains most seconds. If there are multiply answers, please output the biggest clock number.

输入样例 复制
5 1
2 4
10 3
1 5
2 8
7 8
输出样例 复制
Case #1: 4
Case #2: 8

说明

7
35
通过提交
时空限制1000ms/32mb
题目来源
评测方式在线评测
题目类型
难        度