結果

問題 No.2008 Super Worker
ユーザー norioc
提出日時 2025-09-26 02:13:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 413 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 82,612 KB
実行使用メモリ 137,176 KB
最終ジャッジ日時 2025-09-26 02:13:20
合計ジャッジ時間 7,178 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


def key(x):
    a, b = x
    return (b - 1) / a


xs = list(zip(A, B))

x = 1
ans = 0
for a, b in sorted(xs, key=key, reverse=True):
    ans += a * x
    ans %= MOD
    x *= b
    x %= MOD

print(ans)
0