SCORES - Editorial (NPLTZ15)

PROBLEM LINK:

Contest

Author: Aniket Marlapalle
Tester: Devamanyu Hazarika
Editorialist: Devamanyu Hazarika

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Sorting

PROBLEM:

Scores of N students in an exam are given and asked to find top two scores of the students.

EXPLANATION:

The question can be simply solved by sorting the array and printing elements from the last two indices.

Time complexity - O(NlogN) , where N is the size of the array

ALTERNATIVE SOLUTION:

It can also be solved by iterating over all the elements of the array by keeping track of two maximum numbers of the array.

Time complexity - O(N) , where N is the size of the array

AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.

Whats wrong with this then …?? its resulted in WA…
link text

@aniket20 Please look into my solution which I submitted within 10 minutes of the start of the contest which showed wrong answer, I looked into other solutions , they are same as well.
https://www.codechef.com/viewsolution/8585974

Please ensure array allocation is under static binding. So allocate arrays as global variables

same case was happening to me…but when i reversed the array and print first two elements than it says correct answer

Someone please tell me why am I getting TLE with nlogn solution with Fast IO…
https://www.codechef.com/viewsolution/8586095

https://www.codechef.com/viewsolution/8586594

whats wrong in this?

@saeedjassani
Use static binding.
https://www.codechef.com/viewsolution/8595176

Can anyone tell whats wrong with these 2 solutions:

First one got WA: https://www.codechef.com/viewsolution/8611372

Second one got AC: https://www.codechef.com/viewsolution/8611391

The only modification is i am filling all array as zero in second one (kinda static binding). But whats the reason for first to not work? Elements of the array from 0 to n-1 are already being read from input so it shouldn’t have any problem?

//