Search found 5 matches

Sun Nov 01, 2015 5:43 am
Forum: Volume 119 (11900-11999)
Topic: 11902 - Dominator
Replies: 20
Views: 10140

Re: 11902 - Dominator

First of all. Rund DFS from node 0 this will give you all the nodes reachables from 0 then consider n disctinct graph's let the graph n_i be the same graph g but without the node i run DFS from 0 in those new graphs If node J were reachable from 0 in the original graph and were NOT reachable in the ...
Sat Oct 17, 2015 2:51 am
Forum: Volume 118 (11800-11899)
Topic: 11849 - CD
Replies: 24
Views: 6401

Re: 11849 - CD

Just use 2 pointers instead a map. Suppose we have 2 arrays sorted a1 a2 ... an-1 b1 b2 ... bm-1 start with ans=0 and pa=0 and pb=0 the indexes if( a[pa] == b[pb] ) ans++ then you just advance the pointer in the array which has the least number (if they are equal no matter which you choose) repeat w...
Sat Oct 17, 2015 2:22 am
Forum: Volume 111 (11100-11199)
Topic: 11136 - Hoax or what
Replies: 31
Views: 18386

Re: 11136 - Hoax or what

AC in 0.9 using scanf/printf and multiset
Wed May 06, 2015 1:14 am
Forum: Volume 112 (11200-11299)
Topic: 11226 - Reaching the fix-point.
Replies: 23
Views: 10847

Re: 11226 - Reaching the fix-point.

I got AC in 0.355s Without using shieve. Fisrt- Found a way of factoring a number, I do the TRIAL DIVISION, (just like factoring by hand) anyway. I think that if you could do it in less time, would be great. Given the factoring, computing alpha(n) is easy. (I did it in the same function) Second, Mem...
Fri Apr 03, 2015 2:44 am
Forum: Volume 100 (10000-10099)
Topic: 10075 - Airlines
Replies: 9
Views: 5181

Re: 10075 - Airlines

Yes, you need to round the distance BEFORE sum them. In other words, when you compute the distance between city A and B, store it as the nearest integer. Then apply the algorithm you want- I used C++11 and Floyd I got AC thanks to this forum :) Also, I applied the formula that comes directly from li...