Page 3 of 7

Posted: Fri Aug 11, 2006 3:55 pm
by mf
Yes, it's correct.

Posted: Fri Aug 11, 2006 4:07 pm
by asif_rahman0
/*code is removed*/

Posted: Fri Aug 11, 2006 4:19 pm
by Martin Macko
asif_rahman0 wrote:Please check my Input/Output:

Is it OK?
My AC's output is the same.

Posted: Fri Aug 11, 2006 4:30 pm
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.

Posted: Fri Aug 11, 2006 5:04 pm
by asif_rahman0
now i changed my code. And Still WA.

Posted: Sat Aug 12, 2006 7:31 pm
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...

Please help me!!

Posted: Sun Aug 13, 2006 12:00 am
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?

Re: Please help me!!

Posted: Sun Aug 13, 2006 1:11 am
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.


Posted: Sun Aug 13, 2006 11:37 am
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?

Posted: Sun Aug 13, 2006 2:44 pm
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.

Here is my WA Code

Posted: Mon Aug 14, 2006 1:00 am
by ivan.cu

Code: Select all

Code was remove, thank to all people that help me whit this problem.

Re: Here is my WA Code

Posted: Mon Aug 14, 2006 11:17 am
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.

Posted: Mon Aug 14, 2006 2:55 pm
by ivan.cu
Ok, thank. I neither can found the mistake. I really don't understand what is wrong.

Posted: Mon Aug 14, 2006 4:37 pm
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

Posted: Tue Aug 15, 2006 12:27 am
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?