Page 2 of 3
Re: 11686 How can
Posted: Wed Oct 07, 2009 6:04 pm
by saiful_sust
Some PLZ help me .........
I am try to solve this problem and got WA
Here is my code....
Re: 11686 How can
Posted: Wed Oct 07, 2009 6:29 pm
by arifcsecu
This is topological sort
So try to use vector instead of 2D array
Use dfs algorithm and with in dfs
you have to check back edge and
use a stack to contain the fast blacken vertices
and also take input using scanf
and output using printf
i hopes ....
Re: 11686 How can
Posted: Wed Oct 07, 2009 6:31 pm
by arifcsecu
Code remove
Re: 11686 How can
Posted: Sun Oct 11, 2009 10:03 am
by saiful_sust
Thanks for ur reply ...
one thing u don't need to post my code in ur comment.
Re: 11686 How can
Posted: Wed Oct 14, 2009 8:56 am
by saiful_sust
I M try to solve this problem
BUT got WA many time ...
Now i use topological sort using DFS and vector
Some one PLZ help me .......
HERE is my code
Code: Select all
Cut for edit............................
Re: 11686 How can
Posted: Wed Oct 14, 2009 7:29 pm
by arifcsecu
You make a simple error
n is 10^6
so you vector should be like
vector <long int> g[1000001];
but you declares as
vector <int> adjlist[100001]
Hope it helps
Re: 11686 How can
Posted: Thu Oct 15, 2009 7:44 am
by Igor9669
arifcsecu wrote:You make a simple error
n is 10^6
so you vector should be like
vector <long int> g[1000001];
Hope it helps
May be g(1000001) not g[1000001] ????
Re: 11686 How can
Posted: Thu Oct 15, 2009 11:58 am
by saiful_sust
Thanks arifcsecu and Igor9669 4 ur reply
But i got WA again ...I feel boring with this problem...
Some one PLz help me.
Re: 11686 How can
Posted: Thu Oct 15, 2009 6:18 pm
by helloneo
What I found is k is not initialized at the very first time.. But, I don't know anything else
Your code is quite similar to mine..

Re: 11686 How can
Posted: Thu Oct 15, 2009 6:31 pm
by saiful_sust
Thanks helloneo...for ur post
But still i got WA...
Here is my code..................
Re: 11686 How can
Posted: Thu Oct 15, 2009 6:58 pm
by arifcsecu
code removed
Re: 11686 - Pick up sticks - possible in Java?
Posted: Thu Oct 15, 2009 7:25 pm
by arifcsecu
why not
it is possible in java
This is topological sorting
use dfs
Just use an array for color[]
and use a stack for the topological order of vertices
and use vector for reading graph input instead of 2D array
Hope it helps
Re: 11686 How can
Posted: Sat Oct 17, 2009 1:19 pm
by saiful_sust
Thanks u arifcsecu....
But i don;t got ACCC...
Here is my new code....
Code: Select all
CUT 4 edit........... :oops: :oops:
Re: 11686 How can
Posted: Sat Oct 17, 2009 3:18 pm
by arifcsecu
removed
Re: 11686 How can
Posted: Sun Oct 18, 2009 12:00 pm
by saiful_sust
Thanks 4 ur reply ...
But sorry to say my programme don't work
.............Here is my code