関数適用による状態遷移で DP を解く
Interactive graph