結果

問題 No.216 FAC
ユーザー konabekonabe
提出日時 2018-04-18 18:12:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 440 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-27 04:31:10
合計ジャッジ時間 1,779 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#python 3.5.2

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Scores = {}

for i, a in enumerate(A):
    if B[i] in Scores.keys():
        Scores[B[i]] += a
    else:
        Scores[B[i]] = a

res = sorted(Scores.items(), key=lambda x: x[1])
maxScore = res[-1][1]

if not 0 in Scores.keys():
    print("NO")
else:
    if Scores[0] == maxScore:
        print("YES")
    else:
        print("NO")   
0