結果

問題 No.2008 Super Worker
ユーザー siganaisiganai
提出日時 2022-07-15 21:36:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 144,172 KB
最終ジャッジ日時 2023-09-10 00:52:44
合計ジャッジ時間 11,902 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
78,512 KB
testcase_01 AC 143 ms
78,512 KB
testcase_02 AC 147 ms
78,468 KB
testcase_03 AC 146 ms
78,448 KB
testcase_04 AC 146 ms
78,288 KB
testcase_05 AC 146 ms
78,556 KB
testcase_06 AC 146 ms
78,592 KB
testcase_07 AC 145 ms
78,592 KB
testcase_08 AC 144 ms
78,580 KB
testcase_09 AC 145 ms
78,496 KB
testcase_10 AC 144 ms
78,544 KB
testcase_11 AC 143 ms
78,552 KB
testcase_12 AC 146 ms
78,544 KB
testcase_13 AC 235 ms
80,176 KB
testcase_14 AC 152 ms
80,184 KB
testcase_15 AC 155 ms
80,320 KB
testcase_16 AC 150 ms
80,232 KB
testcase_17 AC 151 ms
79,948 KB
testcase_18 AC 152 ms
80,124 KB
testcase_19 AC 148 ms
79,316 KB
testcase_20 AC 150 ms
80,016 KB
testcase_21 AC 149 ms
79,992 KB
testcase_22 AC 147 ms
79,404 KB
testcase_23 AC 512 ms
143,208 KB
testcase_24 AC 513 ms
143,068 KB
testcase_25 AC 503 ms
143,124 KB
testcase_26 AC 524 ms
143,204 KB
testcase_27 AC 523 ms
143,340 KB
testcase_28 AC 495 ms
136,048 KB
testcase_29 AC 497 ms
136,048 KB
testcase_30 AC 496 ms
136,200 KB
testcase_31 AC 499 ms
136,048 KB
testcase_32 AC 499 ms
136,012 KB
testcase_33 AC 268 ms
134,744 KB
testcase_34 AC 508 ms
136,136 KB
testcase_35 AC 263 ms
144,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=10 ** 9 + 7

import sys
input=sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ab = []
c = []
for i in range(n):
    if b[i] != 1:
        ab.append([a[i],b[i]])
    else:
        c.append([a[i],b[i]])
    
ab.sort(key = lambda x:x[0]/(x[1] - 1))

ans = 0
now = 1
for a,b in ab:
    ans += now * a
    ans %= mod
    now *= b
    now %= mod
for a,b in c:
    ans += now * a
    ans %= mod
    now *= b
    now %= mod
print(ans)
0