{"version":"1.0","url":"https://anta1.hatenadiary.org/entry/20120918/1347974951","width":"100%","blog_title":"anta\u306e\u7af6\u6280\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7df4\u7fd2\u65e5\u8a18","title":"\u601d\u3044\u3064\u3044\u305f\u3082\u306e\u30e1\u30e2","provider_name":"Hatena Blog","published":"2012-09-18 22:29:11","image_url":null,"type":"rich","provider_url":"https://hatena.blog","height":"190","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fanta1.hatenadiary.org%2Fentry%2F20120918%2F1347974951\" title=\"\u601d\u3044\u3064\u3044\u305f\u3082\u306e\u30e1\u30e2 - anta\u306e\u7af6\u6280\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7df4\u7fd2\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_url":"https://blog.hatena.ne.jp/anta1/","blog_url":"https://anta1.hatenadiary.org/","categories":["\u96d1\u8a18","\u4fe1\u983c\u6027\u4f4e"],"author_name":"anta1","description":"\u203b\u3042\u304f\u307e\u3067\u30e1\u30e2\u30fb\u4fe1\u983c\u6027\u306f\u5168\u304f\u306a\u3044 N\u6587\u5b57\u306eK\u7a2e\u985e\u306e\u6587\u5b57\u304b\u3089\u306a\u308b\u6587\u5b57\u5217str\u3067\u3001\u300ci\u756a\u76ee\u4ee5\u964d\u306b\u6587\u5b57c\u304c\u51fa\u3066\u304f\u308b\u6700\u521d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u5404i,c\u306b\u3064\u3044\u3066\u5168\u3066\u6c42\u3081\u308b\u300d\u306f\u5f8c\u308d\u304b\u3089\u3084\u308b\u3068O(NK) int dp[K][N+1]; for(int c = 0; c < K; c ++) { dp[c][N] = INF; for(int i = N-1; i >= 0; i ++) { dp[c][i] = str[i] == c ? 0 : min(dp[c][i+1]+1, INF); } } \u300c\u9577\u3055N\u306e\u6587\u5b57\u52171\u3092\u3061\u3087\u3046\u3069(exactly)k\u56deswap\u3057\u3066\u6587\u5b57\u52172\u306b\u51fa\u6765\u308b\u304b\uff1f\u300d\u306f int t = N-\u9589\u8def\u2026"}