{"provider_name":"Hatena Blog","width":"100%","author_url":"https://blog.hatena.ne.jp/mayokoex/","published":"2016-08-27 10:11:56","height":"190","provider_url":"https://hatena.blog","author_name":"mayokoex","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmayokoex.hatenablog.com%2Fentry%2F2016%2F08%2F27%2F101156\" title=\"yukicoder No.417 \u30c1\u30e5\u30fc\u30ea\u30c3\u30d7\u30d0\u30d6\u30eb - mayoko\u2019s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","blog_url":"https://mayokoex.hatenablog.com/","title":"yukicoder No.417 \u30c1\u30e5\u30fc\u30ea\u30c3\u30d7\u30d0\u30d6\u30eb","type":"rich","image_url":null,"blog_title":"mayoko\u2019s diary","categories":["yukicoder"],"description":"O(NM^2) \u3060\u3068\u7d50\u69cb\u53b3\u3057\u3081\u306e\u5236\u7d04\u3060\u3068\u601d\u3063\u3066\u3060\u3044\u3076\u60a9\u3093\u3067\u3044\u305f\u3002 \u554f\u984c No.417 \u30c1\u30e5\u30fc\u30ea\u30c3\u30d7\u30d0\u30d6\u30eb - yukicoder \u89e3\u6cd5 O(NM^2) \u306e\u6728 dp \u3092\u3057\u307e\u3059\u3002\u307e\u305a\u8003\u5bdf\u3067\u3059\u304c, \u6700\u5f8c\u306b\u9802\u70b9 0 \u306b\u623b\u3063\u3066\u3053\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3053\u3068\u304b\u3089, v -> u \u3068\u8fba\u3092\u964d\u308a\u305f\u5834\u5408, \u518d\u3073 u -> v \u3068\u623b\u3063\u3066\u3053\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u3064\u307e\u308a, \u901a\u308b\u8fba\u306f\u3059\u3079\u3066 2 \u56de\u901a\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002dp[v][rest] = (\u9802\u70b9 v \u306e\u6642\u70b9\u3067\u6b8b\u308a\u6642\u9593\u304c rest \u306e\u6642\u306e\u6700\u5927\u5229\u76ca) \u3068\u3059\u308b\u3068, v \u306e\u5b50\u304c ch \u3068\u3057\u3066, dp[v][rest] = max(dp[ch][j-(v \u304b\u3089 ch \u306b\u884c\u304f\u30b3\u30b9\u30c8)] \u2026","url":"https://mayokoex.hatenablog.com/entry/2016/08/27/101156"}