{"id":5815,"date":"2022-10-30T08:25:45","date_gmt":"2022-10-29T23:25:45","guid":{"rendered":"https:\/\/suzutukiblog.com\/?p=5815"},"modified":"2022-11-07T11:23:32","modified_gmt":"2022-11-07T02:23:32","slug":"alv-up-2","status":"publish","type":"post","link":"https:\/\/suzutukiblog.com\/index.php\/2022\/10\/30\/alv-up-2\/","title":{"rendered":"PaizaA\u30e9\u30f3\u30afLv\u30a2\u30c3\u30d7\u554f\u984c\u3068\u89e3\u8aac(Ruby)\u305d\u306e1"},"content":{"rendered":"<h1>\u203b\u30b9\u30ad\u30eb\u30c1\u30a7\u30c3\u30af\u554f\u984c\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/h1>\n<h4>\u898f\u7d04\u306b\u3088\u308a\u516c\u5f0f\u306e\u89e3\u7b54\u30b3\u30fc\u30c9\u305d\u306e\u307e\u307e\u306f\u3088\u308d\u3057\u304f\u306a\u3044\u306e\u3067\u3001<br \/>\n\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30b3\u30fc\u30c9\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/h4>\n<p><a href=\"https:\/\/suzutukiblog.com\/index.php\/2022\/09\/21\/paiza_lvup\/\">\u8a73\u3057\u304f\u306f\u30b3\u30c1\u30e9<\/a><\/p>\n<h4>\u306a\u308b\u3079\u304f\u308f\u304b\u308a\u3084\u3059\u3044\u89e3\u8aac\u3092\u4ed8\u3051\u307e\u3057\u305f\u3002<\/h4>\n<h1>\u30de\u30c3\u30d7\u306e\u5224\u5b9a\u30fb\u7e26\u6a2a<\/h1>\n<h1 class=\"a-works-heading1\">\u554f\u984c1\uff1a\u76e4\u9762\u306e\u60c5\u5831\u53d6\u5f97 (paiza\u30e9\u30f3\u30af C \u76f8\u5f53)<\/h1>\n<div class=\"inr\">\n<div class=\"inr\">\n<div class=\"inr1\">\n<div class=\"mb30\">\n<p>\u884c\u6570 H , \u5217\u6570 W \u306e\u76e4\u9762\u304c\u3042\u308a\u3001\u5404\u30de\u30b9\u306b\u306f\u6587\u5b57\u304c 1 \u3064\u3060\u3051\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u76e4\u9762\u3068 N \u500b\u306e y , x \u5ea7\u6a19 \u304c\u4e0e\u3048\u3089\u308c\u308b\u306e\u3067\u3001\u4e0e\u3048\u3089\u308c\u305f\u5ea7\u6a19\u306e\u6587\u5b57\u3092\u9806\u306b\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u306a\u304a\u3001\u30de\u30b9\u306e\u5ea7\u6a19\u7cfb\u306f\u5de6\u4e0a\u7aef\u306e\u30de\u30b9\u306e\u5ea7\u6a19\u3092 ( y , x ) = ( 0 , 0 ) \u3068\u3057\u3001<br \/>\n\u4e0b\u65b9\u5411\u304c y \u5ea7\u6a19\u306e\u6b63\u306e\u5411\u304d\u3001\u53f3\u65b9\u5411\u304c x \u5ea7\u6a19\u306e\u6b63\u306e\u5411\u304d\u3068\u3057\u307e\u3059\u3002<\/p>\n<h3><span style=\"font-weight: bold; font-size: 1rem;\">\u5165\u529b\u3055\u308c\u308b\u5024<\/span><\/h3>\n<\/div>\n<\/div>\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dd>\n<pre>H W N   \r\nS_0     \r\n...     \r\nS_(H-1)    \r\ny_1 x_1     \r\n...     \r\ny_N x_N<\/pre>\n<p>\u30fb 1 \u884c\u76ee\u306b\u306f\u76e4\u9762\u306e\u884c\u6570\u3092\u8868\u3059\u6574\u6570 H , \u76e4\u9762\u306e\u5217\u6570\u3092\u8868\u3059\u6574\u6570 W , \u4e0e\u3048\u3089\u308c\u308b\u5ea7\u6a19\u306e\u6570\u3092\u8868\u3059\u6574\u6570 N \u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002<br \/>\n\u30fb \u7d9a\u304f H \u884c\u306e\u3046\u3061 i \u884c\u76ee (0 \u2266 i &lt; H) \u306b\u306f\u3001\u76e4\u9762\u306e i \u884c\u76ee\u306e\u6587\u5b57\u3092\u307e\u3068\u3081\u305f\u6587\u5b57\u5217 S_i \u304c\u4e0e\u3048\u3089\u308c\u3001S_i \u306e j \u6587\u5b57\u76ee\u306f\u3001\u76e4\u9762\u306e i \u884c\u76ee\u306e j \u5217\u76ee\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u6587\u5b57\u3092\u8868\u3057\u307e\u3059\u3002<br \/>\n\u30fb \u7d9a\u304f N \u884c \u306b\u306f\u3001\u6587\u5b57\u3092\u7b54\u3048\u308b\u305f\u3081\u306e y_i , x_i \u5ea7\u6a19\u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002(1 \u2266 i \u2266 N)<\/p>\n<h3><span style=\"font-size: 1rem;\">\u671f\u5f85\u3059\u308b\u51fa\u529b<\/span><\/h3>\n<\/dd>\n<\/dl>\n<\/div>\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dd>N \u884c\u306e\u51fa\u529b<\/p>\n<p>\u30fb i \u884c\u76ee (1 \u2266 i \u2266 N) \u306b\u306f\u3001i \u756a\u76ee\u306e\u5ea7\u6a19 y_i, x_i \u306e\u76e4\u9762\u306e\u6587\u5b57 A_i \u3092\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>A_1        \r\n...     \r\nA_N<\/pre>\n<\/dd>\n<\/dl>\n<\/div>\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dt class=\"icon4\">\u6761\u4ef6<\/dt>\n<dd>\u3059\u3079\u3066\u306e\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306b\u304a\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u6761\u4ef6\u3092\u307f\u305f\u3057\u307e\u3059\u3002<\/p>\n<pre>\u30fb 1 \u2266 H , W \u2266 20\r\n\u30fb 1 \u2266 N \u2266 H \u00d7 W\r\n\u30fb 0 \u2266 y_i &lt; H , 0 \u2266 x_i &lt; W (0 \u2266 i &lt; N)\r\n\u30fb S \u306f W \u6587\u5b57\u306e\u6587\u5b57\u5217\r\n\u30fb S \u306e\u5404\u6587\u5b57\u306f . \u307e\u305f\u306f #<\/pre>\n<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n<\/div>\n<dl class=\"txt2\">\n<dt>\n<h4>\u5165\u529b\u4f8b1<\/h4>\n<\/dt>\n<dd>\n<pre>3 3 2\r\n\r\n###\r\n\r\n###\r\n\r\n...\r\n\r\n2 2\r\n\r\n1 1<\/pre>\n<\/dd>\n<dd>\n<h1><span style=\"font-size: 0.857143rem;\">\u51fa\u529b\u4f8b1<\/span><\/h1>\n<\/dd>\n<dd>\n<pre><span style=\"font-size: 0.857143rem;\">.\r\n<\/span>#<\/pre>\n<\/dd>\n<dd>\n<h1><span style=\"font-size: 0.857143rem;\">\u5165\u529b\u4f8b2<\/span><\/h1>\n<\/dd>\n<dd>\n<pre><span style=\"font-size: 0.857143rem;\">2 2 1\r\n<\/span>#.\r\n.#\r\n0 1<\/pre>\n<\/dd>\n<dd>\n<h1><span style=\"font-size: 0.857143rem;\">\u51fa\u529b\u4f8b2<\/span><\/h1>\n<\/dd>\n<dd>\n<pre><span style=\"font-size: 0.857143rem;\">.<\/span><\/pre>\n<\/dd>\n<\/dl>\n<h3>\u4f55\u304c\u554f\u308f\u308c\u3066\u3044\u308b\u304b\uff1f(\u554f\u984c\u306e\u62bd\u8c61\u5316)<\/h3>\n<p>\u591a\u6b21\u5143\u914d\u5217\u306e\u57fa\u790e\u7684\u306a\u64cd\u4f5c\u65b9\u6cd5(\u51fa\u529b)<\/p>\n<div class=\"inr\">\n<div class=\"inr\">\n<div class=\"inr2\">\n<h3>\u89e3\u7b54\u3068\u89e3\u8aac(\u5165\u529b\u4f8b1\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3066\u3044\u307e\u3059)<\/h3>\n<pre>#1\u884c\u76ee\u306e\u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308a\u305d\u308c\u305e\u308c\u306e\u5909\u6570\u306b\u4ee3\u5165\r\nh,w,n = gets.split.map(&amp;:to_i)\r\nary = []\r\n\r\n#\u76e4\u9762\u306e\u60c5\u5831\u3092\u53d7\u53d6\u308a\u5909\u6570\u306b\u4ee3\u5165\u3059\u308b\u3002\r\nh.times.map do\r\n  ary &lt;&lt; gets.chomp\r\nend\r\nn.times do |i|\r\n#\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u523b\u307f\u306e\u5165\u529b\u5024\u3092\u53d7\u3051\u53d6\u308a\u5909\u6570\u306b\u4ee3\u5165\r\n  y,x = gets.split.map(&amp;:to_i)\r\n#\u5165\u529b\u4f8b1\u306e\u6642ary[2][2]\u3068ary[1][1]\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\u308f\u3051\u306a\u306e\u3067\r\n  puts ary[y][x] \r\nend<\/pre>\n<\/div>\n<div class=\"inr1\">\n<div class=\"mb30\">\n<h1 class=\"a-works-heading1\">\u554f\u984c2\uff1a\u76e4\u9762\u306e\u60c5\u5831\u5909\u66f4 (paiza\u30e9\u30f3\u30af C \u76f8\u5f53)<\/h1>\n<p>\u884c\u6570 H , \u5217\u6570 W \u306e\u76e4\u9762\u304c\u3042\u308a\u3001\u5404\u30de\u30b9\u306b\u306f\u6587\u5b57\u304c 1 \u3064\u3060\u3051\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u76e4\u9762\u3068 N \u500b \u306e y , x \u5ea7\u6a19 \u304c\u4e0e\u3048\u3089\u308c\u308b\u306e\u3067\u3001\u76e4\u9762\u306e\u4e0e\u3048\u3089\u308c\u305f\u5ea7\u6a19\u306e\u6587\u5b57\u3092 &#8220;#&#8221; \u306b\u66f8\u304d\u63db\u3048\u305f\u5f8c\u306e\u76e4\u9762\u3092\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u306a\u304a\u3001\u30de\u30b9\u306e\u5ea7\u6a19\u7cfb\u306f\u5de6\u4e0a\u7aef\u306e\u30de\u30b9\u306e\u5ea7\u6a19\u3092 ( y , x ) = ( 0 , 0 ) \u3068\u3057\u3001<br \/>\n\u4e0b\u65b9\u5411\u304c y \u5ea7\u6a19\u306e\u6b63\u306e\u5411\u304d\u3001\u53f3\u65b9\u5411\u304c x \u5ea7\u6a19\u306e\u6b63\u306e\u5411\u304d\u3068\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<\/div>\n<div class=\"inr2\">\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dt class=\"icon2\">\u5165\u529b\u3055\u308c\u308b\u5024<\/dt>\n<dd>\n<pre>H W N   \r\nS_0       \r\n...     \r\nS_(H-1)     \r\ny_1 x_1     \r\n...     \r\ny_N x_N<\/pre>\n<p>\u30fb 1 \u884c\u76ee\u306b\u306f\u76e4\u9762\u306e\u884c\u6570\u3092\u8868\u3059\u6574\u6570 H , \u76e4\u9762\u306e\u5217\u6570\u3092\u8868\u3059\u6574\u6570 W , \u4e0e\u3048\u3089\u308c\u308b\u5ea7\u6a19\u306e\u6570\u3092\u8868\u3059\u6574\u6570 N \u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002<br \/>\n\u30fb \u7d9a\u304f H \u884c\u306e\u3046\u3061 i \u884c\u76ee (0 \u2266 i &lt; H) \u306b\u306f\u3001\u76e4\u9762\u306e i \u884c\u76ee\u306e\u6587\u5b57\u3092\u307e\u3068\u3081\u305f\u6587\u5b57\u5217 S_i \u304c\u4e0e\u3048\u3089\u308c\u3001 S_i \u306e j \u6587\u5b57\u76ee\u306f\u3001\u76e4\u9762\u306e i \u884c\u76ee\u306e j \u5217\u76ee\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u6587\u5b57\u3092\u8868\u3057\u307e\u3059\u3002(0 \u2266 j &lt; W)<br \/>\n\u30fb \u7d9a\u304f N \u884c \u306b\u306f\u3001 \u6587\u5b57\u3092\u66f8\u304d\u63db\u3048\u308b\u30de\u30b9\u306e y , x \u5ea7\u6a19\u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\u3002(1 \u2266 i \u2266 N)<\/dd>\n<\/dl>\n<\/div>\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dt class=\"icon3\">\u671f\u5f85\u3059\u308b\u51fa\u529b<\/dt>\n<dd>H \u884c\u3067\u306e\u51fa\u529b<\/p>\n<p>\u30fb \u66f8\u304d\u63db\u3048\u305f\u5f8c\u306e\u76e4\u9762\u3092 H \u884c\u3067\u51fa\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>T_0       \r\n...     \r\nT_(H-1)<\/pre>\n<\/dd>\n<\/dl>\n<\/div>\n<div class=\"box3\">\n<dl class=\"txt1\">\n<dt class=\"icon4\">\u6761\u4ef6<\/dt>\n<dd>\u3059\u3079\u3066\u306e\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306b\u304a\u3044\u3066\u3001\u4ee5\u4e0b\u306e\u6761\u4ef6\u3092\u307f\u305f\u3057\u307e\u3059\u3002<\/p>\n<pre>\u30fb 1 \u2266 H , W \u2266 20\r\n\u30fb 1 \u2266 N \u2266 H \u00d7 W\r\n\u30fb 0 \u2266 y &lt; H, 0 \u2266 x &lt; W\r\n\u30fb S \u306f W \u6587\u5b57\u306e\u6587\u5b57\u5217\r\n\u30fb S \u306e\u5404\u6587\u5b57\u306f \".\" \u307e\u305f\u306f \"#\"<\/pre>\n<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<dl class=\"txt2\">\n<dt>\u5165\u529b\u4f8b1<\/dt>\n<dd>\n<pre>3 3 1\r\n\r\n...\r\n\r\n...\r\n\r\n...\r\n\r\n0 0<\/pre>\n<\/dd>\n<\/dl>\n<dl class=\"txt2\">\n<dt>\u51fa\u529b\u4f8b1<\/dt>\n<dd>\n<pre>#..\r\n\r\n...\r\n\r\n...<\/pre>\n<\/dd>\n<\/dl>\n<dl class=\"txt2\">\n<dt>\u5165\u529b\u4f8b2<\/dt>\n<dd>\n<pre>4 4 2\r\n\r\n####\r\n\r\n####\r\n\r\n....\r\n\r\n##..\r\n\r\n2 0\r\n\r\n2 2<\/pre>\n<\/dd>\n<dd><span style=\"color: #666666; font-family: Consolas, Monaco, 'Lucida Console', monospace; font-size: 0.857143rem; font-weight: bold;\">\u51fa\u529b\u4f8b2<\/span><\/dd>\n<dd>\n<pre><span style=\"color: #666666; font-family: Consolas, Monaco, 'Lucida Console', monospace; font-size: 0.857143rem;\">####\r\n<\/span>####\r\n#.#.\r\n##..<\/pre>\n<\/dd>\n<\/dl>\n<h3>\u4f55\u304c\u554f\u308f\u308c\u3066\u3044\u308b\u304b\uff1f(\u554f\u984c\u306e\u62bd\u8c61\u5316)<\/h3>\n<p>\u591a\u6b21\u5143\u914d\u5217\u306e\u57fa\u790e\u7684\u306a\u64cd\u4f5c\u65b9\u6cd5(\u7f6e\u304d\u63db\u3048)<\/p>\n<h3>\u89e3\u7b54\u3068\u89e3\u8aac<\/h3>\n<p>\u9014\u4e2d\u307e\u3067\u306f1\u3068\u540c\u3058\u3060\u3051\u308c\u3069\u3082\u3001\u6307\u5b9a\u3057\u305f\u914d\u5217\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5834\u6240\u3092#\u306b\u5909\u3048\u308b\u51e6\u7406\u3092\u66f8\u3051\u3070\u826f\u3044<\/p>\n<pre>h,w,n = gets.split.map(&amp;:to_i)\r\nary = h.times.map { gets.chomp }\r\nn.times do |i|\r\n  y,x = gets.split.map(&amp;:to_i)\r\n# \u3053\u3053\u304c\u9055\u3046\u3088(\u6307\u5b9a\u3057\u305f\u4f4d\u7f6e\u3092#\u306b\u5909\u3048\u308b)\r\n  ary[y][x] = \"#\"\r\nend\r\nputs ary<\/pre>\n<h3><a href=\"https:\/\/suzutukiblog.com\/index.php\/2022\/10\/06\/alv-up-7\/\">\u7d9a\u304d\u307e\u3059<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u203b\u30b9\u30ad\u30eb\u30c1\u30a7\u30c3\u30af\u554f\u984c\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 \u898f\u7d04\u306b\u3088\u308a\u516c\u5f0f\u306e\u89e3\u7b54\u30b3\u30fc\u30c9\u305d\u306e\u307e\u307e\u306f\u3088\u308d\u3057\u304f\u306a\u3044\u306e\u3067\u3001 \u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30b3\u30fc\u30c9\u306b\u3057\u3066\u3044\u307e\u3059\u3002 \u8a73\u3057\u304f\u306f\u30b3\u30c1\u30e9 \u306a\u308b\u3079\u304f\u308f\u304b\u308a\u3084\u3059\u3044\u89e3\u8aac\u3092\u4ed8\u3051\u307e\u3057\u305f\u3002 \u30de\u30c3\u30d7\u306e\u5224\u5b9a\u30fb\u7e26\u6a2a \u554f\u984c1\uff1a\u76e4\u9762\u306e\u60c5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27,31],"tags":[],"class_list":["post-5815","post","type-post","status-publish","format-standard","hentry","category-programming-note","category-ruby"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=5815"}],"version-history":[{"count":12,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5815\/revisions"}],"predecessor-version":[{"id":6621,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/posts\/5815\/revisions\/6621"}],"wp:attachment":[{"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=5815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=5815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suzutukiblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=5815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}