Search found 71 matches
- Sun Sep 17, 2006 10:47 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 13694
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 want t...
- Wed Sep 13, 2006 8:29 am
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 17536
- Wed Sep 13, 2006 1:31 am
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 13694
- Wed Sep 13, 2006 1:24 am
- Forum: Volume 110 (11000-11099)
- Topic: 11090 - Going in Cycle!!
- Replies: 23
- Views: 13694
- Tue Sep 12, 2006 11:39 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 17536
- Tue Sep 12, 2006 10:40 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11093 - Just Finish it up
- Replies: 14
- Views: 8016
I solved it in O(n) as follows: 1. Starting from any station (let's call it START) and trying to finish the lap. If it's possible then goto print answer, else let's say I couldn't get from p to p+1. 2. Starting from p+1 and trying to finish lap. (I don't need to look for the path starting from inter...
- Tue Sep 12, 2006 1:36 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11088 - End up with More Teams
- Replies: 30
- Views: 17536
- Sun Sep 10, 2006 5:35 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11084 - Anagram Division
- Replies: 19
- Views: 9390
i used smth. like this: mask - bit state need - remainder to get n - number of 1's in mask ... map <pair<int,int>,int> m; int solve(int mask, int need, int n){ int res=m[make_pair(mask,need)]; if (res>0) return res-1; // here comes actual solution m[make_pair(mask,need)]=res+1; return res; } ... But...
- Sun Sep 10, 2006 9:29 am
- Forum: Volume 110 (11000-11099)
- Topic: 11084 - Anagram Division
- Replies: 19
- Views: 9390
- Sat Sep 02, 2006 11:19 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11080 - Place the Guards
- Replies: 40
- Views: 11362
- Sat Sep 02, 2006 7:59 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11077 - Find the Permutations
- Replies: 14
- Views: 7092
- Tue May 30, 2006 7:47 am
- Forum: Algorithms
- Topic: Help on testing point inside a polygon
- Replies: 5
- Views: 1817
- Sat May 13, 2006 10:49 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11029 - Leading and Trailing
- Replies: 43
- Views: 17546
- Sat May 13, 2006 10:25 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11029 - Leading and Trailing
- Replies: 43
- Views: 17546
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: 17546