結果

問題 No.2008 Super Worker
ユーザー nikumakarenikumakare
提出日時 2022-07-15 21:51:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,389 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 120,960 KB
最終ジャッジ日時 2023-09-10 01:26:02
合計ジャッジ時間 20,880 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
72,616 KB
testcase_01 AC 108 ms
72,596 KB
testcase_02 AC 104 ms
72,608 KB
testcase_03 AC 109 ms
72,716 KB
testcase_04 AC 106 ms
72,588 KB
testcase_05 AC 105 ms
72,604 KB
testcase_06 AC 105 ms
72,532 KB
testcase_07 AC 106 ms
72,516 KB
testcase_08 AC 104 ms
72,644 KB
testcase_09 AC 103 ms
72,812 KB
testcase_10 AC 104 ms
72,584 KB
testcase_11 AC 105 ms
72,592 KB
testcase_12 AC 107 ms
72,392 KB
testcase_13 AC 127 ms
78,760 KB
testcase_14 AC 123 ms
78,792 KB
testcase_15 AC 124 ms
78,780 KB
testcase_16 AC 123 ms
78,948 KB
testcase_17 AC 124 ms
78,556 KB
testcase_18 AC 125 ms
78,780 KB
testcase_19 AC 116 ms
77,476 KB
testcase_20 AC 125 ms
78,624 KB
testcase_21 AC 124 ms
78,588 KB
testcase_22 AC 117 ms
77,272 KB
testcase_23 AC 1,339 ms
120,960 KB
testcase_24 AC 1,359 ms
120,412 KB
testcase_25 AC 1,362 ms
120,856 KB
testcase_26 AC 1,331 ms
120,864 KB
testcase_27 AC 1,371 ms
120,540 KB
testcase_28 AC 1,372 ms
116,700 KB
testcase_29 AC 1,336 ms
116,952 KB
testcase_30 AC 1,350 ms
116,668 KB
testcase_31 AC 1,372 ms
117,472 KB
testcase_32 AC 1,353 ms
117,000 KB
testcase_33 AC 261 ms
115,444 KB
testcase_34 AC 1,389 ms
117,120 KB
testcase_35 AC 266 ms
120,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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=0
MOD=10**9+7

lev=1
# T.sort(key=lambda x:-((S-x[0])/x[1]))

import itertools
itr=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_key
def cmp(a, b):
    
    return 1 if a[1]*b[0]+a[0] < b[1]*a[0]+b[0] else -1

T.sort(key=cmp_to_key(cmp))
# print(T)

for a,b in T:
    ans+=lev*a
    ans%=MOD
    lev*=b
    lev%=MOD
        

print(ans)
0