結果

問題 No.216 FAC
コンテスト
ユーザー _KingdomOfMoray
提出日時 2019-11-25 14:01:03
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 21 ms / 1,000 ms
+ 230µs
コード長 341 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-09-15 11:38:11
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

score = [0]*100
score_k = 0
for i in range(n):
    if b[i] == 0:
        score_k += a[i]
    else:
        score[b[i]-1] += a[i]

sorted_score = sorted(score, reverse=True)

if score_k >= sorted_score[0]:
    res = 'YES'
else:
    res = 'NO'

print(res)
0