結果

問題 No.2008 Super Worker
ユーザー ああいい
提出日時 2022-07-17 11:26:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 135,060 KB
最終ジャッジ日時 2024-06-29 12:47:19
合計ジャッジ時間 6,248 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
P = 10 ** 9 + 7
inf = 10 ** 9
def f(x):
    a,b = x
    if b == 1:
        return inf
    else:
        return a / (b - 1)
C = [(a,b) for a,b in zip(A,B)]
C.sort(key = f)
ans = 0
now = 1
for a,b in C:
    ans += a * now
    ans %= P
    now = now * b % P
print(ans)
0