結果
問題 | No.2008 Super Worker |
ユーザー |
![]() |
提出日時 | 2022-07-15 21:51:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,293 ms / 2,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 119,812 KB |
最終ジャッジ日時 | 2024-06-27 17:32:56 |
合計ジャッジ時間 | 17,144 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
n=int(input())A=[int(i) for i in input().split()]B=[int(i) for i in input().split()]T=[(A[i],B[i]) for i in range(n)]S=sum(A)ans=0MOD=10**9+7lev=1# T.sort(key=lambda x:-((S-x[0])/x[1]))import itertoolsitr=itertools.permutations(T)# for it in itr:# ans=0# lev=1# for a,b in it:# ans+=lev*a# ans%=MOD# lev*=b# lev%=MOD# if ans==2048669:# print(it)from functools import cmp_to_keydef cmp(a, b):return 1 if a[1]*b[0]+a[0] < b[1]*a[0]+b[0] else -1T.sort(key=cmp_to_key(cmp))# print(T)for a,b in T:ans+=lev*aans%=MODlev*=blev%=MODprint(ans)