# CFR 147 B. Smile House ( Binary Search, Fast Matrix Multiplication, DP, Binary Enumeration )

Problem - B - Codeforces題意： 給一個圖，邊用四個值表示，( x, y, Cxy, Cyx )，代表 x 至 y 長度是 Cxy，y 至 x 長度是 Cyx。求是否存在一個正環，若存在則輸出最小環的長度。資料規模： 節點數 1 ≤ N ≤ 300 邊數 0 ≤ M ≤ N * ( N - 1 ) / 2 權值 -1e4 ≤ …

# CFR 621 E. Wet Shark and Blocks ( DP, Fast Matrix Multiplication )

Problem - E - Codeforces題意： 給一個序列，每次隨便選一個數字，加到字串尾。求有幾種方法，挑 B 個數字後，除以 X 的餘數為 K。資料規模： 數字量 2 ≤ N ≤ 50 000 1 ≤ B ≤ 1e9, 0 ≤ K 數字大小 1 ≤ A[ i ] ≤ 9 時限 2000 ms 記憶體 256 MB解法： dp[ i ]…

# NOI12 Day 1 Random Number Generator ( Fast Matrix Multiplication + Fast Multiplication )

PEG Judge - NOI '12 - Random Number Generator www.2cto.com See the formulae here. What's particularly interesting in this problem is that it might cause overflow when calculating the product for some long long integers. However, here again…

# ABC 9 D - 漸化式 ( Fast matrix multiplication + XOR / AND property )

D: 漸化式 - AtCoder Beginner Contest 009 | AtCoder I was surprised that this could be matrix multiplication as well. Abc009 from AtCoder Inc. www.slideshare.net According to the slides, when the operation has property of 0, commutative rul…