結果

問題 No.216 FAC
ユーザー mokraimokrai
提出日時 2017-10-22 17:22:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 814 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-21 13:48:25
合計ジャッジ時間 1,689 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    q_count = int(input())
    scores = [int(i) for i in input().split()]
    answerers = [int(i) for i in input().split()]
    ans_scores = {}
    loop_count = 0
    for i in answerers:
        ans_scores[i] = ans_scores.get(i, 0) + scores[loop_count]
        loop_count += 1
    #print(ans_scores)

    topscore = 0
    topscore_person = ""
    for person in ans_scores:
        if ans_scores[person] == topscore:
            if person == 0:
                topscore = ans_scores[person]
                topscore_person = person
        elif ans_scores[person] > topscore:
            topscore = ans_scores[person]
            topscore_person = person

    #print(topscore_person)
    if topscore_person == 0:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()
0