星期二, 12月 07, 2004

奇蹟

這晚繼續進攻307,雖然再加入了一些heuristic,但仍然無法通過時限.
細想原因是如果程式的estimation不正確,便會陷入深深的dfs去尋找根本不存在的solution...

開始生出邪惡概念...「限制dfs的步數,如果多過theshold便當作沒有solution.」
很明顯地,在理論上這是完全錯誤的.....
不過隨便試試吧......
第一次: theshold = 2000000, 通過不了時限
第二次: theshold = 1000000, 通過不了時限
第三次: theshold = 500000, 通過不了時限
第四次: theshold = 100000, 通過時限(2.x s) Wrong Answer
第五次: theshold = 200000, 通過時限(4.x s) Wrong Answer
第六次: theshold = 300000, 通過時限(7.x s) Wrong Answer
看著這過趨勢,400000應該是最後可以一試的theshold,就改了code交上去.
心想也會WA,便再想想有沒有可改進的地方....


半分鐘後收到mail,剛才的code以9.443秒accepted,離時限只剩0.5秒呀.....
在correctness和runtime之間,竟然讓我找到這一條小狹縫可以讓我通過呀.....
絕對是奇蹟呀!!!!!!!!!

沒有留言: