結果

問題 No.595 登山
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-29 09:44:10
言語 Ruby
(3.2.2)
結果
AC  
実行時間 222 ms / 1,500 ms
コード長 148 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 11,324 KB
実行使用メモリ 38,288 KB
最終ジャッジ日時 2023-07-30 08:14:24
合計ジャッジ時間 7,620 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,168 KB
testcase_01 AC 84 ms
15,248 KB
testcase_02 AC 79 ms
15,312 KB
testcase_03 AC 80 ms
15,188 KB
testcase_04 AC 210 ms
36,500 KB
testcase_05 AC 122 ms
21,388 KB
testcase_06 AC 195 ms
33,572 KB
testcase_07 AC 91 ms
16,160 KB
testcase_08 AC 100 ms
18,052 KB
testcase_09 AC 195 ms
33,752 KB
testcase_10 AC 162 ms
27,880 KB
testcase_11 AC 155 ms
26,612 KB
testcase_12 AC 89 ms
16,216 KB
testcase_13 AC 116 ms
20,568 KB
testcase_14 AC 210 ms
36,996 KB
testcase_15 AC 211 ms
36,816 KB
testcase_16 AC 209 ms
36,868 KB
testcase_17 AC 206 ms
36,844 KB
testcase_18 AC 206 ms
36,852 KB
testcase_19 AC 217 ms
38,252 KB
testcase_20 AC 222 ms
38,164 KB
testcase_21 AC 218 ms
38,288 KB
testcase_22 AC 216 ms
38,276 KB
testcase_23 AC 218 ms
38,112 KB
testcase_24 AC 81 ms
15,152 KB
testcase_25 AC 82 ms
15,344 KB
testcase_26 AC 219 ms
38,244 KB
testcase_27 AC 214 ms
37,504 KB
testcase_28 AC 207 ms
37,508 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,q=gets.split.map &:to_i
h=gets.split.map &:to_i
y=n*q
a=h[x=0]
h.map{|b|x,y,a=[x+q,y+q,b>a ?x+b-a:x].min,[x+q,y+q,a>b ?y+a-b:y].min,b}
p [x,y].min
0