結果

問題 No.2008 Super Worker
ユーザー vwxyzvwxyz
提出日時 2022-07-15 21:40:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,134 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 55,768 KB
最終ジャッジ日時 2023-09-10 01:01:17
合計ジャッジ時間 27,806 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,376 KB
testcase_01 AC 33 ms
10,336 KB
testcase_02 AC 34 ms
10,344 KB
testcase_03 AC 33 ms
10,348 KB
testcase_04 AC 34 ms
10,500 KB
testcase_05 AC 34 ms
10,320 KB
testcase_06 AC 34 ms
10,360 KB
testcase_07 AC 34 ms
10,468 KB
testcase_08 AC 33 ms
10,436 KB
testcase_09 AC 34 ms
10,348 KB
testcase_10 AC 34 ms
10,432 KB
testcase_11 AC 34 ms
10,460 KB
testcase_12 AC 33 ms
10,396 KB
testcase_13 AC 38 ms
10,668 KB
testcase_14 AC 41 ms
10,676 KB
testcase_15 AC 39 ms
10,572 KB
testcase_16 AC 39 ms
10,612 KB
testcase_17 AC 39 ms
10,712 KB
testcase_18 AC 44 ms
10,808 KB
testcase_19 AC 38 ms
10,652 KB
testcase_20 AC 40 ms
10,672 KB
testcase_21 AC 39 ms
10,676 KB
testcase_22 AC 38 ms
10,632 KB
testcase_23 AC 1,980 ms
51,704 KB
testcase_24 AC 1,990 ms
51,992 KB
testcase_25 AC 1,983 ms
51,968 KB
testcase_26 AC 1,968 ms
51,836 KB
testcase_27 AC 1,981 ms
52,000 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 536 ms
55,768 KB
testcase_34 TLE -
testcase_35 AC 468 ms
47,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N=int(readline())
A=list(map(int,readline().split()))
B=list(map(int,readline().split()))
class idx:
    def __init__(self,i):
        self.i=i
    def __lt__(self,other):
        i=self.i
        j=other.i
        return A[i]+A[j]*B[i]<A[j]+A[i]*B[j]
ans=0
x=1
mod=10**9+7
lst=[idx(i) for i in range(N)]
lst.sort(reverse=True)
for id in lst:
    i=id.i
    ans+=A[i]*x
    x*=B[i]
    ans%=mod
    x%=mod

print(ans)

"""
1
B0
B0*B1

A0
A1*B0
A2*B0*B1

20
30*3

"""
0