結果
| 問題 |
No.2008 Super Worker
|
| コンテスト | |
| ユーザー |
siganai
|
| 提出日時 | 2022-07-15 21:36:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 386 ms / 2,000 ms |
| コード長 | 698 bytes |
| コンパイル時間 | 395 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 147,648 KB |
| 最終ジャッジ日時 | 2024-06-27 17:06:57 |
| 合計ジャッジ時間 | 7,697 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#!/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)
siganai