結果

問題 No.216 FAC
ユーザー knt3110
提出日時 2018-05-19 11:30:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 339 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-28 14:20:34
合計ジャッジ時間 1,780 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

count=[0 for i in range(n)]
count_k=0

for i in range(n):
    if b[i]==0:
        count_k+=a[i]
    else:
        count[b[i]-1]+=a[i]

jud=0
for i in range(n):
    if count_k<count[i]:
        jud+=1

if jud==0:
    print('YES')
else:
    print('NO')
0