結果

問題 No.2008 Super Worker
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-07-16 10:20:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,382 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 133,752 KB
最終ジャッジ日時 2023-09-10 17:54:22
合計ジャッジ時間 20,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
72,492 KB
testcase_01 AC 112 ms
72,328 KB
testcase_02 AC 111 ms
72,392 KB
testcase_03 AC 109 ms
72,392 KB
testcase_04 AC 111 ms
72,112 KB
testcase_05 AC 112 ms
72,384 KB
testcase_06 AC 112 ms
72,160 KB
testcase_07 AC 111 ms
72,296 KB
testcase_08 AC 116 ms
72,464 KB
testcase_09 AC 112 ms
72,348 KB
testcase_10 AC 111 ms
72,208 KB
testcase_11 AC 115 ms
72,324 KB
testcase_12 AC 113 ms
72,140 KB
testcase_13 AC 127 ms
77,848 KB
testcase_14 AC 129 ms
77,828 KB
testcase_15 AC 130 ms
77,816 KB
testcase_16 AC 129 ms
77,844 KB
testcase_17 AC 128 ms
78,196 KB
testcase_18 AC 131 ms
78,352 KB
testcase_19 AC 121 ms
77,664 KB
testcase_20 AC 124 ms
77,916 KB
testcase_21 AC 125 ms
77,880 KB
testcase_22 AC 122 ms
77,764 KB
testcase_23 AC 1,360 ms
133,596 KB
testcase_24 AC 1,349 ms
133,344 KB
testcase_25 AC 1,337 ms
133,340 KB
testcase_26 AC 1,348 ms
133,408 KB
testcase_27 AC 1,343 ms
133,752 KB
testcase_28 AC 1,341 ms
128,380 KB
testcase_29 AC 1,369 ms
128,488 KB
testcase_30 AC 1,370 ms
128,848 KB
testcase_31 AC 1,349 ms
128,616 KB
testcase_32 AC 1,382 ms
128,636 KB
testcase_33 AC 274 ms
130,424 KB
testcase_34 AC 1,373 ms
129,152 KB
testcase_35 AC 271 ms
126,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
def compare(ab1,ab2):
    a1,b1 = ab1
    a2,b2 = ab2
    if a1 + b1 * a2 >= a2 + a1 * b2:return -1
    else:return 1
ab = [tmp for tmp in zip(*[a,b])]
from functools import cmp_to_key
ab.sort(key=cmp_to_key(compare))
ans = 0
lb = 1
mod = 10 ** 9 + 7
for aa,bb in ab:
    ans += lb * aa
    lb *= bb
    ans %= mod
    lb %= mod
print(ans)
0