結果

問題 No.216 FAC
ユーザー harhogefooharhogefoo
提出日時 2016-10-13 07:31:27
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 330 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-08-14 08:22:22
合計ジャッジ時間 4,218 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,204 KB
testcase_01 AC 81 ms
15,068 KB
testcase_02 AC 79 ms
15,300 KB
testcase_03 AC 79 ms
15,128 KB
testcase_04 AC 82 ms
15,068 KB
testcase_05 AC 82 ms
15,224 KB
testcase_06 AC 79 ms
15,060 KB
testcase_07 AC 80 ms
15,120 KB
testcase_08 AC 79 ms
15,084 KB
testcase_09 AC 81 ms
15,072 KB
testcase_10 AC 79 ms
15,180 KB
testcase_11 AC 79 ms
14,936 KB
testcase_12 AC 80 ms
15,208 KB
testcase_13 AC 80 ms
14,956 KB
testcase_14 AC 79 ms
15,172 KB
testcase_15 AC 81 ms
15,112 KB
testcase_16 AC 81 ms
15,120 KB
testcase_17 AC 80 ms
14,932 KB
testcase_18 AC 80 ms
15,064 KB
testcase_19 AC 80 ms
14,932 KB
testcase_20 AC 80 ms
14,944 KB
testcase_21 AC 80 ms
15,172 KB
testcase_22 AC 81 ms
14,936 KB
testcase_23 AC 79 ms
15,004 KB
testcase_24 AC 81 ms
15,168 KB
testcase_25 AC 80 ms
15,200 KB
testcase_26 AC 80 ms
15,124 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)

h = Hash.new(0)

b.length.times do |i|
  h[b[i]] += a[i]
end

zero = h[0]

if zero == nil
  puts "NO"
  exit
end

check = true
h.each do |k, v|
  if zero < v
    check = false
    break
  end
end

if check
  puts "YES"
else
  puts "NO"
end
0