410 - Station Balance

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

Moderator: Board moderators

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Greedy is correct. There are some tricky cases.
You can find help from the following forum.

http://online-judge.uva.es/board/viewto ... hlight=410
Ami ekhono shopno dekhi...
HomePage
Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

ACM 410 Can you tell me are my outputs legal?

Post by Wei-Ming Chen »

I got WA again.. This time is problem 410

Sample inputs are

Code: Select all

2 3
6 3 8
3 5
51 19 27 14 33
5 9
1 2 3 5 7 11 13 17 19
and Sample outputs are

Code: Select all

Set #1
 0: 6 3
 1: 8
IMBALANCE = 1.00000

Set #2
 0: 51
 1: 19 27
 2: 14 33
IMBALANCE = 6.00000

Set #3
 0: 1 17
 1: 2 13
 2: 3 11
 3: 5 7
 4: 19
IMBALANCE = 11.60000

But my outputs are

Code: Select all

Set #1
 0: 8
 1: 3 6
IMBALANCE = 1.00000

Set #2
 0: 51
 1: 33 14
 2: 19 27
IMBALANCE = 6.00000

Set #3
 0: 19
 1: 17 1
 2: 13 2
 3: 11 3
 4: 7 5
IMBALANCE = 11.60000

Are my outputs legal? Please tell me , thanks
mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun »

It's a special judge program. Your outputs are legal.
Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Post by Wei-Ming Chen »

AC now
Thanks your help
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Hi
I can't get AC in this problem. I have tried all cases you wrote and I got the correct answer, but when I send the code I get WA. I don't know why.
I paste a part of my code. Could you help me? Thank you very much.
Last edited by NPS on Sat Jul 14, 2007 8:32 pm, edited 1 time in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

It would be better if you paste your full code. And yes, don't forget to use code tags.
Ami ekhono shopno dekhi...
HomePage
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Ok, I'm sorry.

Code: Select all


Last edited by NPS on Tue Jul 17, 2007 11:25 am, edited 1 time in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Try the cases.

Input:

Code: Select all

2 4
335 501 170 725
4 7
963 465 706 146 282 828 962
2 4
943 828 437 392
5 3
154 293 383
Output:

Code: Select all

Set #1
 0: 725 170
 1: 501 335
IMBALANCE = 59.00000

Set #2
 0: 963
 1: 962 146
 2: 828 282
 3: 706 465
IMBALANCE = 250.00000

Set #3
 0: 943 392
 1: 828 437
IMBALANCE = 70.00000

Set #4
 0: 383
 1: 293
 2: 154
 3:
 4:
IMBALANCE = 688.00000
Hope these help.
Ami ekhono shopno dekhi...
HomePage
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Ok. I'm going to try it...
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Thanks Jan, but I can't get AC... I have tried your cases and I get exactly the same output than you:

Code: Select all

Set #1 
 0: 725 170 
 1: 501 335 
IMBALANCE = 59.00000 

Set #2 
 0: 963 
 1: 962 146 
 2: 828 282 
 3: 706 465 
IMBALANCE = 250.00000 

Set #3 
 0: 943 392 
 1: 828 437 
IMBALANCE = 70.00000 

Set #4 
 0: 383 
 1: 293 
 2: 154 
 3: 
 4: 
IMBALANCE = 688.00000 
Can you see any difference?
have I to write a blank space at the end of each number, chamber without specimens...?
I write a \n\n at the end of the last cases:
IMBALANCE = 688.00000\n
\n
Is that correct?
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

NPS wrote:1. Can you see any difference?
2. have I to write a blank space at the end of each number, chamber without specimens...?
3. I write a \n\n at the end of the last cases:
IMBALANCE = 688.00000\n
\n
Is that correct?
1. No.
2. You dont have to write any space at the end of line. Probably you are using IExplorer, so if you copy the i/o you will find a blank space after every line. Try firefox.
3. Yes, it's correct.

But you will get presentation error if your code is correct but has presentation problems. However, if you are getting wrong answer, then better to post your code :) .
Ami ekhono shopno dekhi...
HomePage
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Sorry... This is my code. I've got the presentation ok, I think. It has to be other thing. I don't know more cases I can try... Thank you very much for all
Last edited by NPS on Thu Jul 19, 2007 1:25 am, edited 1 time in total.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Never use float, use double or long double. 'j' is the set number, and j is a character, what if there are more than 256 cases? And don't use short, because you can have overflow problem easily.

Hope these help.
Ami ekhono shopno dekhi...
HomePage
NPS
New poster
Posts: 6
Joined: Fri Jul 13, 2007 3:24 pm

Post by NPS »

Ok. Thank you very much. That was the problem. I've got AC :)
Mehadi
New poster
Posts: 18
Joined: Sun Jan 24, 2010 11:17 am

WA: 410;PLZ Help

Post by Mehadi »

Sorry
Last edited by Mehadi on Sat Apr 17, 2010 6:48 am, edited 1 time in total.
Post Reply

Return to “Volume 4 (400-499)”