結果

問題 No.216 FAC
ユーザー gemmarogemmaro
提出日時 2019-09-09 06:53:35
言語 Ruby
(3.4.1)
結果
AC  
実行時間 95 ms / 1,000 ms
コード長 373 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-06-28 00:36:25
合計ジャッジ時間 3,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
scores = gets.chomp.split.map &:to_i
solvers = gets.chomp.split.map &:to_i
solvers_by_id = Array.new(100, 0)

k = 0
n.times {|i|
    score = scores[i]
    solver = solvers[i]
    if solver == 0
        k += score
    else
        solvers_by_id[solver-1] += score
    end
}

others = solvers_by_id.max
if k >= others
    puts "YES"
else
    puts "NO"
end
0