It also can be solved using binary search + Floyd.
I think you binary search for the mean value, but can you explain how you use floyd warshall to test if a cycle with this mean (or less) exists?
Well, I know about Karp's algo (see Cormen) but I solved it using Floyd only!
Here is my idea:
I ...
Search found 71 matches
- Sun Sep 17, 2006 10:47 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 16181
- Wed Sep 13, 2006 8:29 am
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 22968
- Wed Sep 13, 2006 1:31 am
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 16181
- Wed Sep 13, 2006 1:24 am
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 16181
- Tue Sep 12, 2006 11:39 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 22968
- Tue Sep 12, 2006 10:40 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11093 - Just Finish it up
- Replies: 14
- Views: 11136
- Tue Sep 12, 2006 1:36 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 22968
- Sun Sep 10, 2006 5:35 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11084 - Anagram Division
- Replies: 19
- Views: 11682
- Sun Sep 10, 2006 9:29 am
- Forum: Volume 110 (11000-11099)
- Topic: 11084 - Anagram Division
- Replies: 19
- Views: 11682
- Sat Sep 02, 2006 11:19 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11080 - Place the Guards
- Replies: 40
- Views: 18249
- Sat Sep 02, 2006 7:59 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11077 - Find the Permutations
- Replies: 14
- Views: 9621
- Tue May 30, 2006 7:47 am
- Forum: Algorithms
- Topic: Help on testing point inside a polygon
- Replies: 5
- Views: 2532
- Sat May 13, 2006 10:49 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11029 - Leading and Trailing
- Replies: 43
- Views: 23965
- Sat May 13, 2006 10:25 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11029 - Leading and Trailing
- Replies: 43
- Views: 23965
It's because of overflow
Replace
with
or
in the main program use
instead of
Replace
Code: Select all
return (pangkat(search(a,b/2))%1000*a%1000)%1000;
Code: Select all
return (pangkat(search(a,b/2))%1000*(a%1000))%1000;
in the main program use
Code: Select all
search(a%1000,b)
Code: Select all
search(a,b)
- Sat May 13, 2006 7:25 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11029 - Leading and Trailing
- Replies: 43
- Views: 23965