結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-08-05 11:29:19 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 458 bytes | 
| コンパイル時間 | 272 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-10-11 20:31:47 | 
| 合計ジャッジ時間 | 1,986 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 WA * 4 | 
ソースコード
N = int(input())
point = input().split()
point = [int(i) for i in point]
ans = input().split()
ans = [int(i) for i in ans]
score = [[0 for i in range(2)] for j in range(101)]
for j in range(0, 100):
    score[j][0] = j
for i in range(0, (N-1)):
    score[ans[i]][1] = score[ans[i]][1] + point[i]
K = score[0][1]
flag = 0
for i in range(1, 100):
    if K < score[i][1]:
        flag = 1
        break
if(flag == 0):
    print("YES")
else:
    print("NO")