0w1

Entries from 2016-07-07 to 1 day

HR Absolute Element Sums ( lower_bound )

https://www.hackerrank.com/challenges/playing-with-numbers 差不多就是把不會變符號的先處理掉,然後把會變號的區間找出來做特別處理。做幾個 case就會發現會變號的部分造成的影響是 區間長度 * x + 2 * 區間和 注意 long long 然後我寫了快兩個小時,low…

HR Bike Racers ( Binary Search + Maximum Matching )

https://www.hackerrank.com/challenges/bike-racers 參考了這篇:用于二分图匹配的匈牙利算法 | Comzyh的博客 第一次寫二分圖最大匹配,原來沒有想像中那麼難。我想二分圖最大匹配基本上可以想成是求婚問題,一群男士和一群女士有一些關聯,這些關聯可以用…

HR Square Subsequences ( DP + Common Subsequence )

https://www.hackerrank.com/challenges/square-subsequences Sum up all the number of different common subsequences, for a = s[ 0, x ), b = s[ x ] + s( x, s.size() ) Ɐ 1 ≤ x with an additional restriction where s[ x ] must be taken in b. // n…