UVA-11078
Open Credit System
Time Limit: 3000MS |
Memory Limit: Unknown |
64bit IO Format: %lld &%llu |
Submit Status
Description
Problem E
Open Credit System
Input: standard input
Output: Standard Output
In an open credits system, the students can choose any course they as, but there is a problem. Some of the students is more senior than other students. The professor of such a course have found quite a number of such students who came from senior classes (as if they came to Attend the pre requisite course after passing a advanced course). But he wants to does justice to the new students. So, he's going to take a placement test (basically an IQ test) to assess the level of difference among the students. He wants to know the maximum amount of score, a senior student gets more than any junior student. For example, if a senior student gets the and a junior student gets, then this amount is 10. Be careful that we don ' t want the absolute value. Help the professor into figure out a solution.
Input
Input consists of a number of test cases T (less than 20). Each case starts with a integer n which is the number of students in the course. This value can is as large as 100,000 and as low as 2. Next n lines contain n integers where the i' th integer is the score of the i' th student. All these integers has absolute values less than 150000. If I < J, then i' th student are senior to the J' th student.
Output
For each test case, the output of the desired number in a new line. Follow the format shown in Sample Input-output section.
Sample input Output for sample input
Problemsetter:mohammad Sajjadhossain
Special Thanks:shahriar Manzoor
Source
Root:: Prominent problemsetters:: Mohammad Sajjad Hossain
Root:: Competitive programming 2:this increases the lower bound of programming contests. Again (Steven & Felix Halim):: Problem Solving Paradigms:: Complete Search:: Iterative (the easier Ones)
Root:: Competitive programming 3:the New Lower Bound of programming contests (Steven & Felix Halim):: Problem Solvi Ng Paradigms:: Complete Search:: Iterative (one Loop, Linear Scan)
Root:: AOAPC i:beginning Algorithm Contests--Training Guide (Rujia Liu):: Chapter 1. Algorithm Design:: Designing Efficient Algorithms:: Examples
AC Code:
Uva-11078-open Credit System (Application of high efficiency algorithm!!) )