結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-04-30 00:50:36 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 41 ms / 1,000 ms | 
| コード長 | 417 bytes | 
| コンパイル時間 | 173 ms | 
| コンパイル使用メモリ | 82,092 KB | 
| 実行使用メモリ | 52,352 KB | 
| 最終ジャッジ日時 | 2024-11-19 10:54:15 | 
| 合計ジャッジ時間 | 2,165 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    scores = [0 for i in range(100)]
    score = 0
    for i in range(n):
        if b[i] == 0:
            score += a[i]
        else:
            scores[b[i]-1] += a[i]
    ans = "YES" if score >= max(scores) else "NO"
    # print(score, scores)
    print(ans)
if __name__ == "__main__":
    main()