結果

問題 No.2008 Super Worker
ユーザー 👑 tamatotamato
提出日時 2022-07-15 21:39:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,378 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 142,544 KB
最終ジャッジ日時 2023-09-10 00:58:57
合計ジャッジ時間 20,885 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
72,292 KB
testcase_01 AC 110 ms
72,440 KB
testcase_02 AC 108 ms
72,444 KB
testcase_03 AC 111 ms
72,296 KB
testcase_04 AC 110 ms
72,436 KB
testcase_05 AC 110 ms
72,428 KB
testcase_06 AC 110 ms
72,336 KB
testcase_07 AC 111 ms
72,280 KB
testcase_08 AC 107 ms
72,460 KB
testcase_09 AC 106 ms
72,272 KB
testcase_10 AC 109 ms
72,472 KB
testcase_11 AC 109 ms
72,404 KB
testcase_12 AC 107 ms
72,420 KB
testcase_13 AC 124 ms
77,816 KB
testcase_14 AC 123 ms
77,684 KB
testcase_15 AC 120 ms
77,772 KB
testcase_16 AC 120 ms
77,584 KB
testcase_17 AC 122 ms
77,972 KB
testcase_18 AC 126 ms
77,848 KB
testcase_19 AC 118 ms
77,212 KB
testcase_20 AC 124 ms
77,564 KB
testcase_21 AC 122 ms
78,020 KB
testcase_22 AC 122 ms
77,264 KB
testcase_23 AC 1,343 ms
142,252 KB
testcase_24 AC 1,378 ms
142,288 KB
testcase_25 AC 1,364 ms
142,460 KB
testcase_26 AC 1,361 ms
142,544 KB
testcase_27 AC 1,330 ms
142,140 KB
testcase_28 AC 1,343 ms
133,712 KB
testcase_29 AC 1,340 ms
133,880 KB
testcase_30 AC 1,350 ms
133,420 KB
testcase_31 AC 1,340 ms
133,592 KB
testcase_32 AC 1,332 ms
133,472 KB
testcase_33 AC 277 ms
133,172 KB
testcase_34 AC 1,334 ms
134,312 KB
testcase_35 AC 282 ms
140,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0