結果

問題 No.216 FAC
ユーザー kazukikazuki
提出日時 2019-02-07 23:33:32
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 293 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 11,436 KB
実行使用メモリ 15,560 KB
最終ジャッジ日時 2023-09-08 14:15:54
合計ジャッジ時間 4,336 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,144 KB
testcase_01 AC 83 ms
15,320 KB
testcase_02 AC 83 ms
15,252 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 80 ms
15,028 KB
testcase_08 AC 82 ms
15,120 KB
testcase_09 AC 83 ms
15,164 KB
testcase_10 AC 81 ms
15,024 KB
testcase_11 AC 84 ms
15,108 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 82 ms
15,072 KB
testcase_17 RE -
testcase_18 AC 81 ms
15,204 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 82 ms
15,060 KB
testcase_22 RE -
testcase_23 AC 82 ms
15,140 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
a_sum = Array.new(n, 0)

k_possible_point = 0
n.times do |i|
  if b[i] != 0
    a_sum[b[i]] += a[i]
  else
    k_possible_point += a[i]
  end
end

if a_sum.max > k_possible_point
  puts 'NO'
else
  puts 'YES'
end
0