Search found 4 matches

by Bodo
Mon Jun 07, 2004 12:15 pm
Forum: Volume 5 (500-599)
Topic: 560 - Magic
Replies: 12
Views: 7534

Do you have any suggestions? Below is my code. I do not have any idea what is wrong with my code. #include <stdio.h> #include <string.h> #include <ctype.h> const int Length=22, HashSize=19019, HashFactor=17; char Max[Length], Key[HashSize][Length], Val[HashSize][Length]; bool Used[HashSize]; int has...
by Bodo
Fri Jun 04, 2004 11:43 am
Forum: Volume 5 (500-599)
Topic: 560 - Magic
Replies: 12
Views: 7534

I still have problems with 560. My program seems to be quite efficient (approx. 2s), but gets WA all the time. On input 15 904390 38502352 43963409 5632950142 54960601673125 69436025369230 64309635065690245634 69832064398623063231 69054623692356023693 8759890412418924142 3333333333333333333 11124444...
by Bodo
Fri May 14, 2004 10:31 am
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 51712

Re: Topological Sorting

2. Dist(v) = -1 for all nodes, D(Source)=0. If you put Dist[v] = -inf , then your algorithm should be accepted. Actually, I handle -1 as -inf. The problem was not my algorithm, but the input. See the "Fixing mistakes" section for more details. Now I received "AC" with my algorit...
by Bodo
Thu May 06, 2004 6:56 pm
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 51712

Topological Sorting

I tried to solve the problem as follows: 1. Order the nodes topologically (we have an acyclic graph here). 2. Dist(v) = -1 for all nodes, D(Source)=0. 3. For all nodes v in that order: - For all edges from v to x: - if(D(v)+1>D(x)) - D(x)=D(v)+1 4. Output the node x with maximum D(x) (if there is a ...

Go to advanced search