0w1

Entries from 2016-07-03 to 1 day

HR Larry's Array ( Math Invariant )

https://www.hackerrank.com/challenges/larrys-array Rotating on any permutation, the number of inversions will have difference by exactly 2. Initially, the correct permutation has no inversion, which means only if the number of inversion is…

Yuki No.387 ハンコ ( Bitset )

No.387 ハンコ - yukicoder bitsetで塗る部分を処理するだけで32倍早くなるあれ。 動的宣言できないんだなbitset。 #include <bits/stdc++.h> using namespace std; typedef vector< int > vi; typedef vector< vi > vvi; const int MAXN = 1e5 + 5; const int MAXCOL = 1e5</bits/stdc++.h>…

CFR 342 E. Xenia and Tree ( LCA + Square Decompostion )

Problem - E - Codeforces 如果對於一個詢問,對所有塗色點取最小距離,複雜度為O( N ),如果對於一個添加所有點的答案,複雜度為O( N )。又只要開始的時候將所有始點押入 queue,囤積複數個始點再更新所有點的答案的複雜度依然為O( N ),可以考慮平方分割。…