Page 1 of 2

11341 - Term Strategy

Posted: Mon Nov 12, 2007 10:00 am
by shakil
Why WA?? please help......

Code: Select all

Cut after AC.....

Posted: Mon Nov 12, 2007 10:14 am
by rio
Try this.

Code: Select all

printf("Maximal possible average mark - %.2lf.\n",d+1e-9); 
----
Rio

Posted: Mon Nov 12, 2007 10:48 am
by emotional blind
I am also getting WA

Code: Select all

Code Removed

Posted: Mon Nov 12, 2007 2:10 pm
by rio
Try this.
Input:

Code: Select all

1
2 2
9 10
1 2
Output:

Code: Select all

Peter, you shouldn't have played billiard that much.
----
Rio

Posted: Mon Nov 12, 2007 4:40 pm
by emotional blind
Thanks
Accepted now..

Posted: Tue Nov 13, 2007 6:56 am
by armansuleimenov
I don't think I completely understand what I am asked in this problem. Could someone explain me?

Posted: Tue Nov 13, 2007 10:57 pm
by sclo
armansuleimenov wrote:I don't think I completely understand what I am asked in this problem. Could someone explain me?
Think of the input in terms of nxm matrix. (0 based indexed)
Row i, column j means the studying ith course for j+1 hours can get you a score of L[j]
We want to find an solution vector x[] such that L[x]>=5 and sum(x+1,i=0..n-1)<=m and sum(L[x],i=0..n-1) is maximal.

Posted: Tue Nov 13, 2007 11:06 pm
by luishhh
Is there any tricky i/o for this problem?
I use a very simple dp which gives WA

Edit: got AC, precision issue printing the output

Posted: Tue Nov 13, 2007 11:10 pm
by sclo
luishhh wrote:Is there any tricky i/o for this problem?
I use a very simple dp which gives WA
Did you handle the case where every number on a row is less than 5?

Posted: Sun Nov 18, 2007 11:09 pm
by jaywinyeah
Thanks for the suggestion above to add 1e-9 to my answer before rounding to two decimal places. With that one change, I got AC instead of the many WA's I was getting. Why do we need to add 1e-9 and how did you figure that out?

Posted: Sun Nov 18, 2007 11:25 pm
by Leonid
jaywinyeah wrote:Thanks for the suggestion above to add 1e-9 to my answer before rounding to two decimal places. With that one change, I got AC instead of the many WA's I was getting. Why do we need to add 1e-9 and how did you figure that out?
Because you may have the result 6.125 or something similar. The computer represents this number as: 6.12499999999, that is why the result may be rounded to 6.12, instead of 6.13.

Posted: Mon Nov 19, 2007 12:11 am
by jaywinyeah
That makes sense. Is it a good practice to add 1e-9 to every problem that requires a decimal answer? Thanks.

Posted: Thu Jan 03, 2008 3:47 pm
by cegomes
I tried to solve the problem using DP but, even I'm almost sure that my solution is right, I'm still getting WA. Could someone post some test cases for me to try to find the error?

Thanks!

Posted: Fri Jan 04, 2008 4:10 pm
by cegomes
Ah! Finally I got AC. Believe or not my mistake was that I was using " ` " instead of " ' ".

11341 - Term Strategy(Clarification)

Posted: Thu Nov 29, 2012 1:10 pm
by BUET
I think there is no test case where all grade value are less than 5 for a particular case.

So i think this input is invalid

Code: Select all

1
2 2
9 10
1 2
I got accepted by considering the fact that at least one grade value is greater than or equal to 5 for a particular course.

Shadek
BUET,CSE-07