結果

問題 No.2008 Super Worker
ユーザー vwxyzvwxyz
提出日時 2022-07-15 21:40:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,565 ms / 2,000 ms
コード長 1,085 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 154,588 KB
最終ジャッジ日時 2023-09-10 01:02:36
合計ジャッジ時間 27,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
91,324 KB
testcase_01 AC 260 ms
91,532 KB
testcase_02 AC 260 ms
91,336 KB
testcase_03 AC 258 ms
91,672 KB
testcase_04 AC 262 ms
91,580 KB
testcase_05 AC 261 ms
91,484 KB
testcase_06 AC 257 ms
91,560 KB
testcase_07 AC 265 ms
91,472 KB
testcase_08 AC 258 ms
91,532 KB
testcase_09 AC 259 ms
91,388 KB
testcase_10 AC 259 ms
91,596 KB
testcase_11 AC 258 ms
91,340 KB
testcase_12 AC 264 ms
91,512 KB
testcase_13 AC 279 ms
94,868 KB
testcase_14 AC 280 ms
95,284 KB
testcase_15 AC 278 ms
95,312 KB
testcase_16 AC 280 ms
95,488 KB
testcase_17 AC 275 ms
95,336 KB
testcase_18 AC 279 ms
95,196 KB
testcase_19 AC 274 ms
94,248 KB
testcase_20 AC 276 ms
95,360 KB
testcase_21 AC 277 ms
95,200 KB
testcase_22 AC 274 ms
94,464 KB
testcase_23 AC 1,526 ms
154,076 KB
testcase_24 AC 1,530 ms
154,088 KB
testcase_25 AC 1,536 ms
154,320 KB
testcase_26 AC 1,526 ms
154,588 KB
testcase_27 AC 1,553 ms
154,088 KB
testcase_28 AC 1,518 ms
145,756 KB
testcase_29 AC 1,516 ms
145,852 KB
testcase_30 AC 1,533 ms
145,780 KB
testcase_31 AC 1,557 ms
145,808 KB
testcase_32 AC 1,542 ms
145,736 KB
testcase_33 AC 435 ms
144,624 KB
testcase_34 AC 1,565 ms
144,284 KB
testcase_35 AC 417 ms
154,216 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)
0