Links for all tutorials of July long challange for practice and contest seem to be swapped. Please consider correcting them .
Could someone please tell me why I’m a getting a TLE in my solution. I’ve used priority queue.
Your code into infinite loop for cases like this-
1
3 6
2 2 300
1 1 1000
2 2 300
please explain how to implement priority queue here?? i am not able to understand plz tell @vijju123
Need help!
My solution is passing Subtask 1 completely but it fails Subtask 2 completely.
Can anyone please help me figure it out where am i doing wrong?
Here is my link to solution.
My solution is also failing for Subtask 2 don’t know why. Though the logic is same as explained in editorial.
https://www.codechef.com/viewsolution/19193154
long sadness = 0;
for(Teacher t: remaining) {
sadness += t.lectures*t.sadness;
Declare t.sadness as long
instead of int
or use type casting as sadness+=1LL * t.lectures * t.sadness;
- because product of 2 int
is stored in the int
type and then the overflowed result is stored in sadness.