結果

問題 No.595 登山
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-25 16:37:07
言語 Ruby
(3.3.0)
結果
AC  
実行時間 188 ms / 1,500 ms
コード長 150 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 31,732 KB
最終ジャッジ日時 2023-10-14 09:51:18
合計ジャッジ時間 7,532 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
15,192 KB
testcase_01 AC 71 ms
15,120 KB
testcase_02 AC 69 ms
15,020 KB
testcase_03 AC 72 ms
15,032 KB
testcase_04 AC 169 ms
30,460 KB
testcase_05 AC 100 ms
19,968 KB
testcase_06 AC 167 ms
30,116 KB
testcase_07 AC 80 ms
16,084 KB
testcase_08 AC 84 ms
17,576 KB
testcase_09 AC 164 ms
30,124 KB
testcase_10 AC 137 ms
24,300 KB
testcase_11 AC 129 ms
24,016 KB
testcase_12 AC 76 ms
16,168 KB
testcase_13 AC 97 ms
19,988 KB
testcase_14 AC 174 ms
30,072 KB
testcase_15 AC 180 ms
30,232 KB
testcase_16 AC 178 ms
30,188 KB
testcase_17 AC 178 ms
30,156 KB
testcase_18 AC 174 ms
30,116 KB
testcase_19 AC 176 ms
31,612 KB
testcase_20 AC 186 ms
31,620 KB
testcase_21 AC 188 ms
31,452 KB
testcase_22 AC 174 ms
31,468 KB
testcase_23 AC 182 ms
31,452 KB
testcase_24 AC 65 ms
15,304 KB
testcase_25 AC 67 ms
15,080 KB
testcase_26 AC 188 ms
31,732 KB
testcase_27 AC 181 ms
30,936 KB
testcase_28 AC 168 ms
30,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,q=gets.split.map &:to_i
h=gets.split.map &:to_i
y=1e18
a=h[x=0]
h.each{|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