TLE in C2. Exam in BerSU (hard version) of Codeforces Round #568 (Div. 2)

Revision en1, by Ashish, 2019-06-21 08:40:17

Hey there,
Problem
My Solution
I wrote a solution which uses priority queue and pops the maximum element until the sum of elements inside the priority queue is greater than (m-ti) for all 1<=i<=n, so the running time (according to me) is n*logn*max(ti) as at every pop operation the sum will reduce by atleast 1 (1<=ti<=100), logn for priority queue operations and total of n students.
When I submitted the code, it gave me TLE on test #14.
Any help is appreciated.
Thank You.

Tags #568, #tle, priority queue, #implementation

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ashish 2019-06-21 08:40:17 676 Initial revision (published)