{"id":4434,"date":"2023-04-09T01:07:18","date_gmt":"2023-04-08T16:07:18","guid":{"rendered":"https:\/\/k.foolslab.net\/dailyreport\/?p=4434"},"modified":"2023-04-09T01:12:46","modified_gmt":"2023-04-08T16:12:46","slug":"2023-4-8","status":"publish","type":"post","link":"https:\/\/k.foolslab.net\/dailyreport\/2023-4-8\/","title":{"rendered":"2023\/4\/8(\u571f)"},"content":{"rendered":"\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u52d5\u304f\u30b2\u30fc\u30e0\u3092\u4f5c\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u5168\u753b\u9762API\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u306e\u3092\u521d\u3081\u3066\u628a\u63e1\u3057\u305f\u3002\u30b9\u30de\u30db\u3060\u3068\u753b\u9762\u306b\u5bfe\u3057\u3066\u30a2\u30c9\u30ec\u30b9\u30d0\u30fc\u3068\u304b\u304c\u5360\u3081\u308b\u9762\u7a4d\u304c\u591a\u304f\u3066\u6ca1\u5165\u611f\u304c\u524a\u304c\u308c\u308b\u306a\u3042&#8230;\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3060\u304c\u3001\u30b9\u30de\u30db\u3067\u3082\u52d5\u304f\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f\u3002\u7d20\u6674\u3089\u3057\u3044\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>ARC159\u306b\u51fa\u305f\u3002<\/p>\n\n\n\n<p>A: MOD N\u3067\u540c\u3058\u9802\u70b9\u306f\u307b\u307c\u307b\u307c\u540c\u3058\u6271\u3044\u3067\u826f\u3044\u3002\u6700\u521d\u306b\u30ef\u30fc\u30b7\u30e3\u30eb\u30d5\u30ed\u30a4\u30c9\u3057\u3066si MOD N\u3068ti MOD N\u306e\u8ddd\u96e2\u3092\u898b\u308c\u3070\u3088\u3044\u3002si MOD N=ti MOD N\u306e\u3068\u304d\u306f\u3001si=ti\u306a\u3089\u3070\u8ddd\u96e2\u306f0\u3060\u3057si\u2260ti\u306a\u3089\u3070\u8ddd\u96e2\u306f\u884c\u3063\u3066\u623b\u3063\u3066\u304f\u308b\u3068\u304d\u306e\u8ddd\u96e2\u306b\u306a\u308b\u304c\u3001\u3053\u306e\u554f\u984c\u3067\u306fsi\u2260ti\u304c\u4fdd\u8a3c\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u305d\u3053\u306e\u5834\u5408\u5206\u3051\u306f\u3057\u306a\u304f\u3066\u3088\u3044\u3002<\/p>\n\n\n\n<p>B: gcd\u304c\u7b49\u3057\u3044\u5834\u5408\u3092\u4e00\u6c17\u306b\u51e6\u7406\u3057\u305f\u304f\u306a\u308b\u3002g=gcd(a,b), a=ga&#8217;, b=gb&#8217;\u3068\u304a\u304f\u3002\u4e00\u822c\u6027\u3092\u5931\u308f\u305ab&#8217;&gt;a&#8217;\u3068\u3059\u308b\u3002<\/p>\n\n\n\n<p>gcd(a&#8217;-k,b&#8217;-k)\u22601\u3068\u306a\u308b\u6700\u5c0f\u306e\u6b63\u6574\u6570k\u3092\u6c42\u3081\u308c\u3070\u305d\u306e\u56de\u6570\u307e\u3068\u3081\u3066\u5f15\u304f\u3053\u3068\u304c\u51fa\u6765\u308b\u3002\u5168\u63a2\u7d22\u3067\u306f\u9593\u306b\u5408\u308f\u306a\u3044\u3002\u7d30\u304b\u3044\u8a3c\u660e\u306f\u7701\u304f\u304c\u3001\u9811\u5f35\u3063\u3066\u8003\u3048\u308b\u3068k\u306fb&#8217;-a&#8217;\u306e\u7d04\u6570\u3067\u3042\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u306e\u3067\u7d04\u6570\u5168\u63a2\u7d22\u3059\u308c\u3070\u3088\u3044\u3002k\u3092\u6c42\u3081\u3066a,b\u305d\u308c\u305e\u308c\u304b\u3089gk\u3092\u5dee\u3057\u5f15\u304f\u3002\u3053\u308c\u3092\u7e70\u308a\u8fd4\u305b\u3070\u89e3\u3051\u308b\u3002<\/p>\n\n\n\n<p>\u3042\u3068\u306f\u540c\u3058gcd\u3092\u4e00\u6c17\u306b\u51e6\u7406\u3059\u308b\u306e\u304c\u4f55\u56de\u7a0b\u5ea6\u3067\u6e08\u3080\u304b\u3068\u3044\u3046\u8a71\u3060\u304c\u3001\u3053\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u8003\u3048\u308b\u3068g\u306f\u5c11\u306a\u304f\u3068\u30821\u56de\u306b2\u500d\u4ee5\u4e0a\u305a\u3064\u5897\u3048\u3066\u3044\u304f\u305f\u3081\u3001$O(\\log max(a,b))$\u56de\u3067\u7d42\u4e86\u3059\u308b\u3002\u7d04\u6570\u5168\u63a2\u7d22\u90e8\u3092\u8003\u616e\u3057\u3066\u3082$O(\\sqrt{\\max(a,b)}\\log \\max(a,b))$\u306a\u306e\u3067\u9593\u306b\u5408\u3046\u3002<\/p>\n\n\n\n<p>C: \u5206\u304b\u3089\u305a\u3002\u4e00\u56de\u306e\u64cd\u4f5c\u3067\u5897\u3048\u308b\u7dcf\u548c\u306fN(N+1)\/2\u3067\u4e00\u5b9a\u306e\u306f\u305a\u3067\u3042\u308a\u3001\u3059\u3079\u3066\u306eA\u306e\u5024\u304c\u7b49\u3057\u3051\u308c\u3070A\u306e\u7dcf\u548c\u306fN\u306e\u500d\u6570\u306b\u306a\u308b\u306f\u305a\u306a\u306e\u3067\u3001\u6700\u521d\u306eA\u306e\u7dcf\u548c\u306bN(N+1)\/2\u306e\u500d\u6570\u3092\u8db3\u3057\u3066N\u306e\u500d\u6570\u306b\u306a\u3089\u306a\u3044\u306a\u3089\u3070\u4e0d\u53ef\u80fd\u3060\u3068\u3044\u3046\u3053\u3068\u306f\u5206\u304b\u308b\u3002\u305d\u3053\u304b\u3089\u5148\u306f\u5206\u304b\u3089\u306a\u3044\u3002<\/p>\n\n\n\n<p>D: [Li, Ri]\u3068\u3044\u3046\u9023\u7d9a\u90e8\u306e\u3069\u3053\u304b\u3092\u63a1\u7528\u3059\u308b\u306a\u3089\u9023\u7d9a\u90e8\u306e\u6700\u5f8c\u307e\u3067\u63a1\u7528\u3057\u3066\u3082\u640d\u306f\u306a\u3044\u3002\u5f8c\u308d\u306b\u3088\u308a\u5927\u304d\u3044\u5024\u307e\u3067\u4f38\u3073\u308b\u9023\u7d9a\u90e8\u304c\u3042\u308b\u306a\u3089\u3070\u305d\u3061\u3089\u3078\u9077\u79fb\u3067\u304d\u308b\u3057\u3001\u5f8c\u308d\u306b\u305d\u306e\u3088\u3046\u306a\u90e8\u5206\u304c\u306a\u3044\u306a\u3089\u73fe\u5728\u306e\u9023\u7d9a\u90e8\u3067\u6700\u5f8c\u307e\u3067\u63a1\u7528\u3059\u308b\u306e\u304c\u6700\u826f\u3060\u304b\u3089\u3060\u3002\u3053\u308c\u3092\u8003\u3048\u308b\u3068\u9023\u7d9a\u90e8\u306e\u7aef\u70b9\u306b\u304a\u3051\u308b\u72b6\u614b\u306e\u307f\u8003\u3048\u308c\u3070\u3088\u3044\u3053\u3068\u304c\u5206\u304b\u308b\u3002\u666e\u901a\u306eLIS\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u3061\u3087\u3063\u3068\u5de5\u592b\u3059\u308b\u3002<\/p>\n\n\n\n<p>Li\u672a\u6e80\u306e\u5024\u304b\u3089\u9077\u79fb\u3059\u308b\u3068\u304d\u3001\u3053\u308c\u306f\u5358\u7d14\u306bLi\u672a\u6e80\u3067\u7d42\u3048\u308b\u5358\u8abf\u5897\u52a0\u5217\u306e\u4e2d\u3067\u9577\u3055\u304c\u6700\u5927\u3068\u306a\u308b\u3068\u3053\u308d\u304b\u3089\u9077\u79fb\u3059\u308c\u3070\u3088\u3044\u3002DP[Ri]\u2190max(DP[Ri], DP[x]+Ri-Li+1)<\/p>\n\n\n\n<p>[Li, Ri]\u306e\u5024\u304b\u3089\u9077\u79fb\u3059\u308b\u3068\u304d\u3001\u3053\u306e\u3068\u304d\u3082\u6700\u7d42\u7684\u306aRi\u5730\u70b9\u306b\u304a\u3051\u308b\u5358\u8abf\u5897\u52a0\u5217\u306e\u9577\u3055\u3092\u6700\u5927\u5316\u3057\u305f\u3044\u3053\u3068\u306f\u5909\u308f\u3089\u306a\u3044\u304c\u3001\u3061\u3087\u3063\u3068\u4e8b\u60c5\u304c\u5909\u308f\u308b\u3002\u4eee\u306bDP[x]\u304b\u3089\u9077\u79fb\u3057\u305f\u3068\u3059\u308b\u3068\u304d\u3001\u3053\u306e\u3088\u3046\u306b\u9077\u79fb\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n\n\n\n<p>DP[Ri]\u2190max(DP[Ri], DP[x]+Ri-x)<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u5f0f\u306b\u306a\u308b\u305f\u3081\u3001\u3053\u308c\u3092\u6700\u5927\u5316\u3059\u308b\u306b\u306f\u3001DP[x]\u304c\u6700\u5927\u306a\u5834\u6240\u3067\u306f\u306a\u304fDP[x]-x\u304c\u6700\u5927\u306a\u5834\u6240\u3092\u53d6\u3063\u3066\u304f\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u3053\u3053\u306b\u6c17\u3092\u4ed8\u3051\u308c\u3070\u89e3\u3051\u308b\u3002<\/p>\n\n\n\n<p>\u672c\u8cea\u7684\u306a\u8003\u5bdf\u306f\u307b\u307c\u5b8c\u307a\u304d\u3060\u3063\u305f\u306e\u3060\u304c\u3001\u7d30\u304b\u3044\u5b9f\u88c5\u3067\u30df\u30b9\u308a\u307e\u304f\u3063\u3066\u3044\u3066WA\u3092\u4f55\u5ea6\u3082\u51fa\u3057\u3001\u7d50\u5c40\u901a\u305b\u306a\u304b\u3063\u305f\u3002\u30e9\u30f3\u30c0\u30e0\u30b1\u30fc\u30b9\u306b\u3088\u308b\u30c6\u30b9\u30c8\u3092\u3057\u305f\u3089\u3059\u3050\u306b\u6483\u589c\u30b1\u30fc\u30b9\u304c\u898b\u3064\u304b\u3063\u305f\u306e\u3067\u672c\u5f53\u306b\u30c0\u30e1\u3002<\/p>\n\n\n\n<p>\u30e9\u30f3\u30c0\u30e0\u30c6\u30b9\u30c8\u304c\u7a81\u7834\u53e3\u306b\u306a\u308b\u306e\u306f\u4f55\u5ea6\u3082\u4f55\u5ea6\u3082\u8eab\u306b\u67d3\u307f\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u306b\u4eca\u56de\u3082\u3067\u304d\u306a\u304b\u3063\u305f\u3002\u4eca\u5ea6\u30c6\u30b9\u30c8\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u308b\u3053\u3068\u306b\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d6\u30e9\u30a6\u30b6\u3067\u52d5\u304f\u30b2\u30fc\u30e0\u3092\u4f5c\u3063\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u5168\u753b\u9762API\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u306e\u3092\u521d\u3081\u3066\u628a\u63e1\u3057\u305f\u3002\u30b9\u30de\u30db\u3060\u3068\u753b\u9762\u306b\u5bfe\u3057\u3066\u30a2\u30c9\u30ec\u30b9\u30d0\u30fc\u3068\u304b\u304c\u5360\u3081\u308b\u9762\u7a4d\u304c\u591a\u304f\u3066\u6ca1\u5165\u611f\u304c\u524a\u304c\u308c\u308b\u306a\u3042&#8230;\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3060\u304c\u3001\u30b9\u30de\u30db\u3067\u3082\u52d5\u304f\u3053\u3068\u3092 &hellip; <\/p>\n<div><a href=\"https:\/\/k.foolslab.net\/dailyreport\/2023-4-8\/\" class=\"more\">Read more &raquo;<span class=\"screen-reader-text\"> &#8220;2023\/4\/8(\u571f)&#8221;<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4434","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/posts\/4434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/comments?post=4434"}],"version-history":[{"count":2,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/posts\/4434\/revisions"}],"predecessor-version":[{"id":4436,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/posts\/4434\/revisions\/4436"}],"wp:attachment":[{"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/media?parent=4434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/categories?post=4434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/k.foolslab.net\/dailyreport\/wp-json\/wp\/v2\/tags?post=4434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}