540 - 競程 CPE 班 (2013/11/14) Scoreboard

Time

2013/11/14 19:05:00 2013/11/14 22:05:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
9164 Stable Sort
9268 Line Segments

9164 - Stable Sort   

Description

Input

 The input includes multiple test cases. In each test case, the first line contains one integer N. The following N lines specify the name Si and the grade Gi.

1 <= N <= 2*106

1 <= |Si| <= 10

0 <= Gi <= 100 (Gi is an integer.)

Output

  Output the result in N lines. Every line contains the name and the grade. If more people’s grades are same, output by input order. (That means it uses stable sort.)

Sample Input  Download

Sample Output  Download

Tags




Discuss




9268 - Line Segments   

Description

There are some line segments in 1 dimensional space. If two segments overlap or one segment’s start is another segment’s end, we consider them as one segment. Please output the length of the longest segment.

Input

There are multiple of test cases.  Each case begins with an integer N (1 <= N <= 106) which represents the number of line segments.  In the next N lines, each line contains two integers a and b (1 <= a <= b <= 109) representing a line segment.  The input is terminated by N = 0.

Output

For each test case, output the length of the longest segment.

Sample Input  Download

Sample Output  Download

Tags




Discuss