結果
問題 | No.871 かえるのうた |
ユーザー | wipex |
提出日時 | 2019-10-24 08:42:23 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 736 bytes |
コンパイル時間 | 96 ms |
コンパイル使用メモリ | 11,572 KB |
実行使用メモリ | 41,732 KB |
最終ジャッジ日時 | 2023-09-22 16:07:24 |
合計ジャッジ時間 | 12,873 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 83 ms
19,504 KB |
testcase_01 | AC | 78 ms
15,324 KB |
testcase_02 | AC | 77 ms
15,044 KB |
testcase_03 | AC | 78 ms
15,044 KB |
testcase_04 | AC | 81 ms
15,144 KB |
testcase_05 | AC | 77 ms
15,284 KB |
testcase_06 | AC | 77 ms
15,252 KB |
testcase_07 | AC | 77 ms
15,248 KB |
testcase_08 | AC | 138 ms
15,896 KB |
testcase_09 | AC | 179 ms
15,952 KB |
testcase_10 | AC | 940 ms
16,156 KB |
testcase_11 | AC | 81 ms
15,412 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 644 ms
16,272 KB |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | AC | 108 ms
18,992 KB |
testcase_19 | RE | - |
testcase_20 | TLE | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
コンパイルメッセージ
Main.rb:4: warning: assigned but unused variable - n Main.rb:12: warning: assigned but unused variable - b Syntax OK
ソースコード
@x=[] a=[] @t=[] n,k = gets.chomp.split(" ").map(&:to_i) @x+=gets.chomp.split(" ").map(&:to_i) a+=gets.chomp.split(" ").map(&:to_i) @hash = Hash[*([@x,a].transpose.flatten)] @c=0 p=@x[k-1] b=a[k-1] def f(p,w) b = @hash[p] zzz = p+w*b zzz1 = p+(-1*w*b) @x.each do |elm| if zzz1 > zzz if elm >=zzz and zzz1 >= elm if @t.any? {|w| w == elm } next else @t.push(elm) end f(elm,1) f(elm,-1) end else if zzz >= elm and elm >= zzz1 if @t.any? {|w| w == elm } next else @t.push(elm) end f(elm,1) f(elm,-1) end end end @c+=1 end f(p,1) f(p,-1) @t=[0] if @t==nil p @t.length