結果

問題 No.2008 Super Worker
ユーザー ansainansain
提出日時 2022-07-15 21:48:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,531 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 86,732 KB
実行使用メモリ 148,396 KB
最終ジャッジ日時 2023-09-10 01:20:29
合計ジャッジ時間 32,769 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
83,956 KB
testcase_01 AC 213 ms
83,924 KB
testcase_02 AC 215 ms
83,556 KB
testcase_03 AC 216 ms
83,552 KB
testcase_04 AC 214 ms
83,556 KB
testcase_05 AC 216 ms
83,712 KB
testcase_06 AC 214 ms
83,688 KB
testcase_07 AC 223 ms
83,740 KB
testcase_08 AC 212 ms
83,684 KB
testcase_09 AC 210 ms
83,720 KB
testcase_10 AC 213 ms
83,820 KB
testcase_11 AC 213 ms
83,460 KB
testcase_12 AC 216 ms
84,004 KB
testcase_13 AC 263 ms
85,472 KB
testcase_14 AC 240 ms
85,076 KB
testcase_15 AC 244 ms
85,360 KB
testcase_16 AC 245 ms
85,296 KB
testcase_17 AC 247 ms
85,376 KB
testcase_18 AC 246 ms
86,192 KB
testcase_19 AC 244 ms
85,460 KB
testcase_20 AC 246 ms
85,236 KB
testcase_21 AC 247 ms
85,248 KB
testcase_22 AC 249 ms
85,340 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 476 ms
145,428 KB
testcase_34 TLE -
testcase_35 AC 458 ms
147,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict, Counter, deque
from itertools import permutations, combinations, product, combinations_with_replacement, groupby, accumulate
import operator
from math import sqrt, gcd, factorial
from fractions import Fraction
#from math import isqrt, prod, comb  #python3.8用(notpypy)
#from bisect import bisect_left, bisect_right
#from functools import lru_cache, reduce
#from heapq import heappush, heappop, heapify, heappushpop, heapreplace
#import numpy as np
#import networkx as nx
#from networkx.utils import UnionFind
#from numba import njit, b1, i1, i4, i8, f8
#numba例 @njit(i1(i4[:], i8[:, :]),cache=True) 引数i4配列、i8 2次元配列,戻り値i1
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, NegativeCycleError, maximum_bipartite_matching, maximum_flow, minimum_spanning_tree
def input(): return sys.stdin.readline().rstrip()
def divceil(n, k): return 1+(n-1)//k  # n/kの切り上げを返す
def yn(hantei, yes='Yes', no='No'): print(yes if hantei else no)


def main():
    mod = 10**9+7
    mod2 = 998244353
    n=int(input())
    A=list(map(int, input().split()))
    B=list(map(int, input().split()))
    comp=[(Fraction(BB-1,AA),AA,BB) for AA,BB in zip(A,B)]
    comp.sort(key=operator.itemgetter(0),reverse=True)
    level=1
    money=0
    for _,AA,BB in comp:
        money+=AA*level
        level*=BB
        level%=mod
    print(money%mod)

if __name__ == '__main__':
    main()

0