結果

問題 No.2008 Super Worker
ユーザー mkawa2mkawa2
提出日時 2022-07-15 21:33:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,250 ms / 2,000 ms
コード長 1,120 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 136,156 KB
最終ジャッジ日時 2023-09-10 00:46:49
合計ジャッジ時間 18,014 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,288 KB
testcase_01 AC 72 ms
71,320 KB
testcase_02 AC 72 ms
71,112 KB
testcase_03 AC 71 ms
71,072 KB
testcase_04 AC 71 ms
71,436 KB
testcase_05 AC 70 ms
71,368 KB
testcase_06 AC 74 ms
71,452 KB
testcase_07 AC 73 ms
71,184 KB
testcase_08 AC 74 ms
71,292 KB
testcase_09 AC 73 ms
71,292 KB
testcase_10 AC 72 ms
71,284 KB
testcase_11 AC 72 ms
71,184 KB
testcase_12 AC 72 ms
71,392 KB
testcase_13 AC 83 ms
76,836 KB
testcase_14 AC 86 ms
76,836 KB
testcase_15 AC 85 ms
76,628 KB
testcase_16 AC 86 ms
76,732 KB
testcase_17 AC 83 ms
76,772 KB
testcase_18 AC 92 ms
76,764 KB
testcase_19 AC 82 ms
75,976 KB
testcase_20 AC 84 ms
76,816 KB
testcase_21 AC 86 ms
76,804 KB
testcase_22 AC 82 ms
75,796 KB
testcase_23 AC 1,247 ms
135,816 KB
testcase_24 AC 1,236 ms
136,156 KB
testcase_25 AC 1,239 ms
135,904 KB
testcase_26 AC 1,237 ms
136,156 KB
testcase_27 AC 1,241 ms
135,876 KB
testcase_28 AC 1,234 ms
124,392 KB
testcase_29 AC 1,225 ms
124,392 KB
testcase_30 AC 1,250 ms
124,296 KB
testcase_31 AC 1,221 ms
124,232 KB
testcase_32 AC 1,237 ms
124,340 KB
testcase_33 AC 226 ms
122,780 KB
testcase_34 AC 1,223 ms
125,160 KB
testcase_35 AC 214 ms
128,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

class Beit:
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def __lt__(self, other):
        return self.a+self.b*other.a > other.a+other.b*self.a

n = II()
aa = LI()
bb = LI()

ab = []
for a, b in zip(aa, bb):
    ab.append(Beit(a, b))

ab.sort()

ans = 0
lv = 1
for i in range(n):
    a, b = ab[i].a, ab[i].b
    ans += lv*a%md
    ans %= md
    lv = lv*b%md

print(ans)
0