結果
問題 | No.2008 Super Worker |
ユーザー | tamato |
提出日時 | 2022-07-15 21:39:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,354 ms / 2,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,424 KB |
実行使用メモリ | 148,484 KB |
最終ジャッジ日時 | 2024-06-27 17:11:53 |
合計ジャッジ時間 | 18,142 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
mod = 1000000007 def main(): import sys input = sys.stdin.readline from functools import cmp_to_key def cmp_func(X, Y): xy0 = X[0] + Y[0] * X[1] xy1 = Y[0] + X[0] * Y[1] if xy0 == xy1: return 0 elif xy0 > xy1: return -1 else: return 1 N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) AB = [(a, b) for a, b in zip(A, B)] AB.sort(key=cmp_to_key(cmp_func)) ans = 0 x = 1 for a, b in AB: ans = (ans + (a * x) % mod)%mod x = (x * b)%mod print(ans % mod) if __name__ == '__main__': main()