結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-10-29 11:54:35 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 31 ms / 1,000 ms | 
| コード長 | 412 bytes | 
| コンパイル時間 | 254 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 10,624 KB | 
| 最終ジャッジ日時 | 2024-09-14 21:26:11 | 
| 合計ジャッジ時間 | 2,347 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge6 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
class Problem0216:
	def solve(this):
		n = int(input())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		
		res = {}
		for (idx, v) in enumerate(b):
			res[v] = res.get(v, 0) + a[idx]
		k1 = res.get(0, 0)
		k2 = sorted(list(res.values()), reverse=True)
		if k1 == k2[0]:
			print("YES")
		else:
			print("NO")
			
if __name__ == "__main__":
	problem = Problem0216()
	problem.solve()