結果

問題 No.216 FAC
コンテスト
ユーザー togatoga
提出日時 2015-08-17 09:05:29
言語 PyPy2
(7.3.20)
結果
RE  
実行時間 -
コード長 274 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 148 ms
コンパイル使用メモリ 77,752 KB
最終ジャッジ日時 2025-12-03 16:16:03
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = input()
a = map(int, raw_input().split())
b = map(int, raw_input().split())
score = 0
other = [0] * (N + 1)
for i in range(N):
    if (b[i] == 0):
        score += a[i]
    else:
        other[b[i]] += a[i]
if (score >= max(other)):
    print "YES"
else:
    print "NO"
0