結果

問題 No.2008 Super Worker
ユーザー PNJ
提出日時 2023-10-24 00:58:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,985 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 54,404 KB
最終ジャッジ日時 2024-09-22 17:57:55
合計ジャッジ時間 24,957 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key
def cmp(x, y):
    a, b = x
    aa, bb = y
    s = a*(bb-1) - aa*(b-1)
    return 1 if s > 0 else -1 if s < 0 else 0

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
mod = 10**9 + 7
C = [(A[i],B[i]) for i in range(N)]
C.sort(key = cmp_to_key(cmp))
x = 1
ans = 0
for a,b in C:
  ans += a*x
  ans %= mod
  x *= b
  x %= mod
print(ans)
0