11341 - Term Strategy

All about problems in Volume 113. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

shakil
Learning poster
Posts: 74
Joined: Sat Jul 15, 2006 6:28 am
Location: CUET , bangladesh
Contact:

11341 - Term Strategy

Post by shakil »

Why WA?? please help......

Code: Select all

Cut after AC.....
Last edited by shakil on Mon Nov 12, 2007 10:17 am, edited 1 time in total.
SHAKIL
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio »

Try this.

Code: Select all

printf("Maximal possible average mark - %.2lf.\n",d+1e-9); 
----
Rio
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

I am also getting WA

Code: Select all

Code Removed
Last edited by emotional blind on Mon Nov 12, 2007 4:42 pm, edited 1 time in total.
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post 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
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

Thanks
Accepted now..
armansuleimenov
New poster
Posts: 15
Joined: Tue Sep 25, 2007 3:07 am
Location: Astana, Kazakhstan
Contact:

Post by armansuleimenov »

I don't think I completely understand what I am asked in this problem. Could someone explain me?
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post 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.
luishhh
New poster
Posts: 26
Joined: Mon Oct 25, 2004 8:11 pm
Location: Spain

Post 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
"From lost to the river" --> Spanish quote
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post 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?
jaywinyeah
New poster
Posts: 19
Joined: Sun Aug 17, 2003 10:40 pm

Post 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?
LL Cool Jay
The Formula Wizard
Jason Winokur
Leonid
Experienced poster
Posts: 146
Joined: Thu Dec 22, 2005 5:50 pm
Contact:

Post 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.
jaywinyeah
New poster
Posts: 19
Joined: Sun Aug 17, 2003 10:40 pm

Post by jaywinyeah »

That makes sense. Is it a good practice to add 1e-9 to every problem that requires a decimal answer? Thanks.
LL Cool Jay
The Formula Wizard
Jason Winokur
cegomes
New poster
Posts: 2
Joined: Thu Jan 03, 2008 3:39 pm

Post 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!
cegomes
New poster
Posts: 2
Joined: Thu Jan 03, 2008 3:39 pm

Post by cegomes »

Ah! Finally I got AC. Believe or not my mistake was that I was using " ` " instead of " ' ".
BUET
New poster
Posts: 22
Joined: Sun Jun 13, 2010 8:38 am

11341 - Term Strategy(Clarification)

Post 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
Post Reply

Return to “Volume 113 (11300-11399)”