結果

問題 No.216 FAC
ユーザー Hirake
提出日時 2017-06-13 13:30:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 364 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-24 16:55:52
合計ジャッジ時間 1,692 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other AC * 1 RE * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#216 FAC
N=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
M=[]*100
K=0
i=0
while i<len(b):
    if b[i]>0:
        M[b[i]]+=a[i]
    else:
        K+=a[i]
    i+=1
S=0
i=0
while i<len(a)-1:
    S+=a[i]
    i+=1
Ma=0
i=0
while i<len(M)-1:
    if Ma<M[i]:
        Ma=M[i]
    i+=1
if K>=Ma:
    print("YES")
else:
    print("NO")
0