0w1

A*

IOI'94 The Buses ( A* + Heuristic by clock )

PEG Judge - IOI '94 - The Buses First we can describe a route by defining its first time of arrival and its interval. After preprocessing all the possible routes, we should perform a brute force search with some heuristic functions to prun…

IOI'94 The Primes ( 暴搜 + 枚舉順序剪枝 )

PEG Judge - IOI '94 - The Primes 不停的 TLE,原來枚舉的順序影響這麼大呢。。 首先最好枚舉兩個對角線,因為他們影響的最大。 接著枚舉外面兩行,所以我們要事先紀錄中間那三個數字總和為多少且頭尾為多少的質數有哪些。 再來我們發現這兩個格子可以 O( 1…