https://www.codechef.com/viewsolution/36137582
I have used this logic
IF my total possible score score will be greater than at least n-k students total score than i will be selected .
else impossible .
https://www.codechef.com/viewsolution/36137582
I have used this logic
IF my total possible score score will be greater than at least n-k students total score than i will be selected .
else impossible .
yes
It’s a WA not compilation error.
can you tell why its wrong
I’m sorry. I’m a bit busy . So it won’t be possible for me to read the question and your logic in your code. You may tag anyone from top contributors to help you.
I have changed (long long int compare) to (int compare) still error is coming I think there may be something wrong in logic part as well
my logic :-
If Sergey gets total possible score more than at least n-k students total score then he will be selected
else it is impossible
Please, whenever you say “I’ve changed the code”, just post the link to the new submission.
Thankyou. This is failing for the exact same reason, for the exact same testcase, as I originally explained.
Just replace your compare
function with the one I suggested.
sir please see new submission i have send link above this
i have done according to what you told
No you haven’t XD
Your compare
:
int compare(const void *p1,const void *p2)
{ int arg1 =*(long long int *)p1;
int arg2 =*(long long int *)p2;
if(arg1<arg2) return -1;
if(arg1>arg2) return 1;
return 0;
}
What I asked you to do:
int compare(const void *p1,const void *p2)
{
const long long int p1AsLong = *(long long int *)p1;
const long long int p2AsLong = *(long long int *)p2;
if (p1AsLong < p2AsLong)
return -1;
if (p1AsLong > p2AsLong)
return +1;
return 0;
}
am sorry i did mistake again
Thanks a lot sir!
you are awesome thanks for help . I am so happy . You have taught very important things . I will be forever thankful to you you .
https://www.codechef.com/viewsolution/36146297