結果

問題 No.871 かえるのうた
ユーザー wipexwipex
提出日時 2019-11-09 23:05:16
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 1,234 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 45,884 KB
最終ジャッジ日時 2023-10-13 07:37:23
合計ジャッジ時間 12,067 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
19,400 KB
testcase_01 AC 81 ms
15,064 KB
testcase_02 AC 80 ms
15,164 KB
testcase_03 AC 80 ms
15,136 KB
testcase_04 AC 82 ms
15,184 KB
testcase_05 WA -
testcase_06 AC 79 ms
15,208 KB
testcase_07 AC 80 ms
15,208 KB
testcase_08 AC 127 ms
15,488 KB
testcase_09 AC 157 ms
15,264 KB
testcase_10 AC 602 ms
15,136 KB
testcase_11 AC 84 ms
15,260 KB
testcase_12 AC 1,577 ms
16,896 KB
testcase_13 AC 614 ms
15,380 KB
testcase_14 AC 256 ms
33,244 KB
testcase_15 AC 1,699 ms
33,160 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
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:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

  @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)
  p=@x[k-1]

  update = true
  @t=[nil]
  xxx = @x.length

  def aaa(elm)
    if @t.any? {|w| w == elm }
      return true
    else
      @t.compact!
      @t<<elm
      return false
    end
  end

  while(update)
    if @t[0]==nil
      b = a[k-1]
      zzz = p+b
      zzz1 = p+(-1*b)
      for i in 0...xxx do
        if zzz1 > zzz
          if @x[i] >=zzz and zzz1 >= @x[i]
            break if aaa(@x[i])==false
          end
        else
          if zzz >= @x[i] and @x[i] >= zzz1
            break if aaa(@x[i])==false
          end
        end
        break if i == xxx-1
      end
    else
      @t.each do |elm|
        j = @x.find_index{|n|n%elm==0}
        b = a[j]
        zzz = elm+b
        zzz1 = elm+(-1*b)
        for i in 0...xxx do
          update = false if i == xxx-1
          if zzz1 > zzz
            if @x[i] >=zzz and zzz1 >= @x[i]
              aaa(@x[i])
            end
          else
            if zzz >= @x[i] and @x[i] >= zzz1
              aaa(@x[i])
            end
          end
        end
      end
    end
  end
if @t==nil
 p "1"
else
 p @t.length
end
0