[問題] Interview street: zombie march
看板Prob_Solve (計算數學 Problem Solving)作者shaopin (problem maker)時間12年前 (2012/10/09 12:48)推噓20(20推 0噓 33→)留言53則, 8人參與討論串1/6 (看更多)
題目: http://goo.gl/pS7Ru (放心 是真正的url)
這題是說 紐約市有N個junction (其實就是graph上的vertex)
整個graph有 M個edge, 是雙向的..
每個node上有initial數量的zombie, 這些zombie每一個
單位時間都會隨機選一個該node的neighbor向之移動
k是總共的時間
題目是要問: 最後 有最多zombie的五個node上的zombie數量
小弟我寫出了解法, https://gist.github.com/3856634
但是光是在test 五個case就只有過了前三個case 其他都應該TLE
在自己的電腦上run 到最後可以run出正確答案, 顯然我的algorithm還不夠好
我的做法是brute force每一個時間都計算最後該時間expected
number of zombies. 但顯然有更好的做法
在此請教不知道更快的做法是否是跟那只選五個最多的zombie node
有關? 但我還是不知道怎麼做??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 69.110.234.65
推
10/09 15:25, , 1F
10/09 15:25, 1F
推
10/09 22:40, , 2F
10/09 22:40, 2F
→
10/09 22:52, , 3F
10/09 22:52, 3F
→
10/09 22:59, , 4F
10/09 22:59, 4F
→
10/09 22:59, , 5F
10/09 22:59, 5F
→
10/09 23:00, , 6F
10/09 23:00, 6F
推
10/09 23:13, , 7F
10/09 23:13, 7F
→
10/09 23:14, , 8F
10/09 23:14, 8F
推
10/09 23:42, , 9F
10/09 23:42, 9F
推
10/09 23:53, , 10F
10/09 23:53, 10F
→
10/10 00:34, , 11F
10/10 00:34, 11F
→
10/10 00:36, , 12F
10/10 00:36, 12F
→
10/10 00:36, , 13F
10/10 00:36, 13F
推
10/10 01:24, , 14F
10/10 01:24, 14F
→
10/10 01:26, , 15F
10/10 01:26, 15F
→
10/10 02:58, , 16F
10/10 02:58, 16F
→
10/10 02:59, , 17F
10/10 02:59, 17F
→
10/10 07:43, , 18F
10/10 07:43, 18F
→
10/10 07:43, , 19F
10/10 07:43, 19F
推
10/10 08:48, , 20F
10/10 08:48, 20F
推
10/10 09:00, , 21F
10/10 09:00, 21F
→
10/10 09:01, , 22F
10/10 09:01, 22F
推
10/10 11:05, , 23F
10/10 11:05, 23F
→
10/10 11:07, , 24F
10/10 11:07, 24F
→
10/10 11:08, , 25F
10/10 11:08, 25F
推
10/10 11:18, , 26F
10/10 11:18, 26F
推
10/10 11:20, , 27F
10/10 11:20, 27F
推
10/10 11:22, , 28F
10/10 11:22, 28F
→
10/10 11:22, , 29F
10/10 11:22, 29F
推
10/10 11:25, , 30F
10/10 11:25, 30F
→
10/10 11:25, , 31F
10/10 11:25, 31F
推
10/10 11:56, , 32F
10/10 11:56, 32F
推
10/10 11:59, , 33F
10/10 11:59, 33F
→
10/10 12:00, , 34F
10/10 12:00, 34F
→
10/10 12:01, , 35F
10/10 12:01, 35F
推
10/10 12:22, , 36F
10/10 12:22, 36F
→
10/10 12:22, , 37F
10/10 12:22, 37F
推
10/10 12:45, , 38F
10/10 12:45, 38F
→
10/10 13:27, , 39F
10/10 13:27, 39F
→
10/10 13:28, , 40F
10/10 13:28, 40F
→
10/10 13:29, , 41F
10/10 13:29, 41F
→
10/10 13:30, , 42F
10/10 13:30, 42F
→
10/10 13:30, , 43F
10/10 13:30, 43F
→
10/10 13:31, , 44F
10/10 13:31, 44F
→
10/10 13:31, , 45F
10/10 13:31, 45F
→
10/10 13:32, , 46F
10/10 13:32, 46F
→
10/10 13:33, , 47F
10/10 13:33, 47F
推
10/15 07:42, , 48F
10/15 07:42, 48F
→
10/15 07:43, , 49F
10/15 07:43, 49F
→
10/15 07:45, , 50F
10/15 07:45, 50F
推
10/15 12:55, , 51F
10/15 12:55, 51F
→
10/15 18:28, , 52F
10/15 18:28, 52F
推
10/25 07:59, , 53F
10/25 07:59, 53F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 6 篇):
Prob_Solve 近期熱門文章
PTT數位生活區 即時熱門文章