結果

問題 No.216 FAC
ユーザー fagfagdfa
提出日時 2017-08-25 20:11:19
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 416 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-10-15 15:43:16
合計ジャッジ時間 1,274 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
a = map(int, raw_input().split())
b = map(int, raw_input().split())

dic = {}

for i in range(n):
    if b[i] not in dic:
        dic[b[i]] = 0
    dic[b[i]] += a[i]

keys = dic.keys()
maxes = [-1, -1]
for i in keys:
    if maxes[0] < dic[i]:
        maxes[0] = dic[i]
        maxes[1] = i
    if maxes[0] == dic[i] and i == 0:
        maxes[1] = i

if maxes[1] == 0:
    print "YES"
else:
    print "NO"
0