結果
問題 |
No.2008 Super Worker
|
ユーザー |
![]() |
提出日時 | 2022-07-16 10:20:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,319 ms / 2,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 138,412 KB |
最終ジャッジ日時 | 2024-06-28 09:05:06 |
合計ジャッジ時間 | 17,768 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) def compare(ab1,ab2): a1,b1 = ab1 a2,b2 = ab2 if a1 + b1 * a2 >= a2 + a1 * b2:return -1 else:return 1 ab = [tmp for tmp in zip(*[a,b])] from functools import cmp_to_key ab.sort(key=cmp_to_key(compare)) ans = 0 lb = 1 mod = 10 ** 9 + 7 for aa,bb in ab: ans += lb * aa lb *= bb ans %= mod lb %= mod print(ans)