結果
問題 |
No.2008 Super Worker
|
ユーザー |
![]() |
提出日時 | 2022-04-27 01:54:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,303 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,144 KB |
実行使用メモリ | 135,000 KB |
最終ジャッジ日時 | 2024-06-28 07:34:31 |
合計ジャッジ時間 | 17,405 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
from functools import cmp_to_key def cmp(a, b): x, y = a[0], a[1] - 1 xx, yy = b[0], b[1] - 1 s = x * yy - y * xx return 1 if s > 0 else -1 if s < 0 else 0 cmpkey = cmp_to_key(cmp) P = 10 ** 9 + 7 N = int(input()) X = sorted([(int(a), int(b)) for a, b in zip(input().split(), input().split())], key = cmpkey) ans = 0 l = 1 for a, b in X: ans = (ans + l * a) % P l = l * b % P print(ans)