410 - Station Balance
Moderator: Board moderators
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
You can find help from the following forum.
http://online-judge.uva.es/board/viewto ... hlight=410
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- Experienced poster
- Posts: 122
- Joined: Sun Nov 13, 2005 10:25 am
- Location: Taiwan
ACM 410 Can you tell me are my outputs legal?
I got WA again.. This time is problem 410
Sample inputs are
and Sample outputs are
But my outputs are
Are my outputs legal? Please tell me , thanks
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
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
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
-
- Experienced poster
- Posts: 122
- Joined: Sun Nov 13, 2005 10:25 am
- Location: Taiwan
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.
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.
It would be better if you paste your full code. And yes, don't forget to use code tags.
Ami ekhono shopno dekhi...
HomePage
HomePage
Ok, I'm sorry.
Code: Select all
Last edited by NPS on Tue Jul 17, 2007 11:25 am, edited 1 time in total.
Try the cases.
Input:
Output:
Hope these help.
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
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
Ami ekhono shopno dekhi...
HomePage
HomePage
Thanks Jan, but I can't get AC... I have tried your cases and I get exactly the same output than you:
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?
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
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?
1. No.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?
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
![:)](./images/smilies/icon_smile.gif)
Ami ekhono shopno dekhi...
HomePage
HomePage
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.
Hope these help.
Ami ekhono shopno dekhi...
HomePage
HomePage