11060 - Beverages

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

Moderator: Board moderators

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

Yes, it's correct.
asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm

Post by asif_rahman0 »

/*code is removed*/
Last edited by asif_rahman0 on Fri Aug 11, 2006 9:23 pm, edited 2 times in total.
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko »

asif_rahman0 wrote:Please check my Input/Output:

Is it OK?
My AC's output is the same.
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko »

asif_rahman0 wrote:Then why i am getting wa again and again?? here is my code:
Try:

Code: Select all

10
A
B
C
D
E
F
G
H
I
J
3
I E
E A
J B
My AC's output:

Code: Select all

Case #1: Dilbert should drink beverages in this order: C D F G H I E A J B.
asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm

Post by asif_rahman0 »

now i changed my code. And Still WA.
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko »

asif_rahman0 wrote:now i changed my code. And Still WA.
If nothing helps to get AC, just post it here again...
ivan.cu
New poster
Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Please help me!!

Post by ivan.cu »

What is teh correct output for

3
a
b
c
1
a c

a b c or b a c or a c b?
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: Please help me!!

Post by Martin Macko »

ivan.cu wrote:What is teh correct output for

3
a
b
c
1
a c

a b c or b a c or a c b?

Code: Select all

Case #1: Dilbert should drink beverages in this order: a b c.

ivan.cu
New poster
Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Post by ivan.cu »

Thank, i don't understand why i have a WA, it's a simple topological sort, i decide the tie for input order and ignore multiple edge. Some one see my error?
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko »

ivan.cu wrote:Thank, i don't understand why i have a WA, it's a simple topological sort, i decide the tie for input order and ignore multiple edge. Some one see my error?
If still getting WA you can post your code here. If I'll have time I'll try to find some I/O your code outputs wrong answer for.
ivan.cu
New poster
Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Here is my WA Code

Post by ivan.cu »

Code: Select all

Code was remove, thank to all people that help me whit this problem.
Last edited by ivan.cu on Tue Aug 15, 2006 12:30 am, edited 1 time in total.
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: Here is my WA Code

Post by Martin Macko »

ivan.cu wrote:

Code: Select all

//import java.io.FileInputStream;
//import java.io.FileNotFoundException;

...
Your code seems working... and I wasn't able to find any I/O it's not working on neither by hand nor by random generator.
ivan.cu
New poster
Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Post by ivan.cu »

Ok, thank. I neither can found the mistake. I really don't understand what is wrong.
Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko »

Found it:
change this:

Code: Select all

g.addEdge(Consola.readWord(), Consola.readWord());
into this:

Code: Select all

String ss = Consola.readWord();
String dd = Consola.readWord();
g.addEdge(ss, dd);
Check this thread, there are some common Java gotchas there:
http://online-judge.uva.es/board/viewtopic.php?t=3805
ivan.cu
New poster
Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Post by ivan.cu »

Thank Darko!!

After ages AC!!!

But i really don't understand this, can you explain to me what problem have:

Code: Select all

g.addEdge(Consola.readWord(), Consola.readWord());
it is exactly:

Code: Select all

String ss = Consola.readWord();
String dd = Consola.readWord();
g.addEdge(ss, dd);
or not?
Post Reply

Return to “Volume 110 (11000-11099)”