kwm_t

kwm_tのメモ

ABC291

■A - camel Case
はい
■B - Trimmed Mean
sort
■C - LRUD Instructions 2
set
■D - Flip Cards
dp
■E - Find Permutation
トポロジカルソートして、ソートしたものが長さnのパスになっているか
■F - Teleporter and Closed off
両方からbfsして飛び越える場合を考える
■G - OR Sum
orで畳み込むのってこんな常識なのか
かたっぽの配列を反転して
どっちもbitを反転させて適当に
畳み込み
演算:and
→a and b = a * b
演算:or
→反転させたもののandを反転させたもの
→a or b = 1 - (1 - a) * (1 - b)
演算:xor
→a xor b = a + b - 2 * a * b= a*(1 - b) + (1 - a) *b
https://mojacoder.app/users/bayashiko/problems/xor-sum-45
■Ex - Balanced Tree
重心分解貼るだけだったらしい