結果
問題 |
No.2008 Super Worker
|
ユーザー |
![]() |
提出日時 | 2023-10-24 00:59:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,299 ms / 2,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 82,120 KB |
実行使用メモリ | 138,832 KB |
最終ジャッジ日時 | 2024-09-22 17:59:59 |
合計ジャッジ時間 | 17,109 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
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)