結果

問題 No.216 FAC
ユーザー ymgckyo
提出日時 2017-11-04 03:37:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 568 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-23 15:51:21
合計ジャッジ時間 2,084 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ls_1 = list(map(int, input().split()))
ls_2 = list(map(int, input().split()))

nobishiro = 0
for i in range(n):
    if ls_2[i] == 0:
        nobishiro += ls_1[i]

highest = 0
others = []
for i in range(n):
    if ls_2[i] != 0:
        for other in others:
            if ls_2[i] == other[0]:
                other[1] += ls_1[i]
                break
        else:
            others.append([ls_2[i], ls_1[i]])

for other in others:
    if other[1] > highest:
        highest = other[1]

if nobishiro >= highest:
    print('YES')
else:
    print('NO')
0