Search found 62 matches

by DP
Sat Sep 20, 2008 6:14 am
Forum: Volume 114 (11400-11499)
Topic: 11481 - Arrange the Numbers
Replies: 10
Views: 4576

Re: 11481 - Arrange the Numbers

@ srrajesh, Use inclusion-exclusion principle. Can you explain a little more? Inclusion and exclusion on what? See the following links: http://answers.yahoo.com/question/index?qid=20080808100200AAXSD4I http://mathworld.wolfram.com/Derangement.html ("Nicholas Bernoulli also solved the problem using t...
by DP
Sat Feb 16, 2008 9:02 am
Forum: Volume 104 (10400-10499)
Topic: 10419 - Sum-up the Primes
Replies: 51
Views: 16775

Sample Input:
20 10
0 0

Sample Output
CASE 1:
No Solution.
by DP
Fri Feb 15, 2008 9:12 pm
Forum: Volume 111 (11100-11199)
Topic: 11125 - Arrange Some Marbles
Replies: 20
Views: 12977

Re: got WA

i can't find any bug in my code. Can any body help me? if( dp[a1][a2][a3][a4][siz][fir][last][firsize] != -1 ) return dp[a1][a2][a3][a4][siz][fir][last][firsize]; ................ .... for( int i = 0;i < 4; i++ ) for( int j = 0;j < 4; j++ ) for( int k = 0;k < 4; k++ ) for( int z = 0; z < 4; z++ ) i...
by DP
Fri Feb 08, 2008 2:11 pm
Forum: Volume 2 (200-299)
Topic: 270 - Lining Up
Replies: 48
Views: 16132

Thnx, silly mistake.
by DP
Fri Feb 08, 2008 12:20 pm
Forum: Volume 2 (200-299)
Topic: 270 - Lining Up
Replies: 48
Views: 16132

Nothing changed helloneo. :(
Still wrong answer.
I modified into this:

Code: Select all

if(ax>0.000001) tem=atan(ay/ax);
else tem=atan(0.0);
by DP
Thu Feb 07, 2008 5:33 pm
Forum: Volume 2 (200-299)
Topic: 270 - Lining Up
Replies: 48
Views: 16132

Code: Select all

cut
by DP
Sun Jan 20, 2008 8:46 am
Forum: Volume 113 (11300-11399)
Topic: 11396 - Claw Decomposition
Replies: 12
Views: 4474

Output:

Code: Select all

YES
YES
by DP
Sat Jan 12, 2008 5:19 pm
Forum: Volume 113 (11300-11399)
Topic: 11386 - Triples
Replies: 23
Views: 8557

11386 - Triples

Code: Select all

cut
by DP
Thu Jan 10, 2008 5:46 pm
Forum: Volume 113 (11300-11399)
Topic: 11324 - The Largest Clique
Replies: 11
Views: 6472

Use Dynamic Programming. Hint 1: Decomposing a directed graph into its strongly connected components. Hint 2: If we merge the vertices in each strong component into a single super vertex, and joint two super vertices (A, B) if and only if there are vertices u is element of A and v is element of B su...
by DP
Tue Oct 30, 2007 3:13 pm
Forum: Volume 113 (11300-11399)
Topic: 11331 - The Joys of Farming
Replies: 13
Views: 6692

Oh, i got accepted already.
But i used correct algorithm. :)

I was getting wrong answer for dp[1010][1010], but i changed it to dp[1010][2020] then got accepted.
by DP
Mon Oct 29, 2007 3:43 pm
Forum: Algorithms
Topic: Need expert's view for geometry algos.
Replies: 23
Views: 9355

by DP
Mon Oct 29, 2007 1:50 pm
Forum: Volume 113 (11300-11399)
Topic: 11331 - The Joys of Farming
Replies: 13
Views: 6692

Same here.
by DP
Mon Oct 29, 2007 1:03 pm
Forum: Volume 113 (11300-11399)
Topic: 11331 - The Joys of Farming
Replies: 13
Views: 6692

What will be the outputs for this inputs?

Code: Select all

5
4 8 8
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9

3 2 4
1 2
2 3
3 1
2 4

4 8 6
1 2
3 4
5 6
7 8
9 10
11 12

10 3 9
1 2
2 3
4 6
9 8
1 9
10 11
13 6
5 8
12 7

7 7 8
1 2
3 4
5 6
1 7
1 8
1 9
8 9
2 9
by DP
Mon Oct 22, 2007 8:36 am
Forum: Volume 113 (11300-11399)
Topic: 11318 - Marble Game
Replies: 10
Views: 3389

11318 - Marble Game

Can someone tell me?
input

Code: Select all

3
1 1 1
output

Code: Select all

3 3
how?
by DP
Sat Oct 13, 2007 4:55 pm
Forum: Algorithms
Topic: DAG path enumeration
Replies: 2
Views: 2157

Re: DAG path enumeration

bugzpodder wrote:Given a DAG (directed acyclic graph), a start and end vertex, enumerate all path lengths between them. What is the fastest algorithm?
I think DFS(depth first search) is the best, if you use adjacent list.

Go to advanced search