結果

問題 No.2008 Super Worker
ユーザー shobonvipshobonvip
提出日時 2022-07-15 22:34:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,322 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 131,548 KB
最終ジャッジ日時 2023-09-10 03:27:06
合計ジャッジ時間 20,389 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
72,368 KB
testcase_01 AC 105 ms
72,204 KB
testcase_02 AC 105 ms
72,304 KB
testcase_03 AC 105 ms
72,336 KB
testcase_04 AC 104 ms
72,576 KB
testcase_05 AC 102 ms
72,152 KB
testcase_06 AC 106 ms
72,492 KB
testcase_07 AC 105 ms
72,540 KB
testcase_08 AC 104 ms
72,552 KB
testcase_09 AC 106 ms
72,472 KB
testcase_10 AC 105 ms
72,372 KB
testcase_11 AC 106 ms
72,516 KB
testcase_12 AC 106 ms
72,384 KB
testcase_13 AC 120 ms
77,704 KB
testcase_14 AC 118 ms
77,912 KB
testcase_15 AC 121 ms
77,756 KB
testcase_16 AC 120 ms
77,816 KB
testcase_17 AC 122 ms
77,720 KB
testcase_18 AC 122 ms
77,900 KB
testcase_19 AC 116 ms
77,320 KB
testcase_20 AC 118 ms
77,788 KB
testcase_21 AC 121 ms
77,972 KB
testcase_22 AC 117 ms
77,436 KB
testcase_23 AC 1,322 ms
131,448 KB
testcase_24 AC 1,296 ms
131,424 KB
testcase_25 AC 1,284 ms
131,548 KB
testcase_26 AC 1,286 ms
131,424 KB
testcase_27 AC 1,292 ms
131,468 KB
testcase_28 AC 1,308 ms
124,180 KB
testcase_29 AC 1,302 ms
124,160 KB
testcase_30 AC 1,305 ms
124,072 KB
testcase_31 AC 1,303 ms
124,192 KB
testcase_32 AC 1,300 ms
124,132 KB
testcase_33 AC 259 ms
124,044 KB
testcase_34 AC 1,310 ms
125,112 KB
testcase_35 AC 254 ms
130,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cmp_to_key

mod = 10**9 + 7

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
dat = [(a[i],b[i]-1) for i in range(n)]

def fraccomp(a, b):
	u = a[0] * b[1] - a[1] * b[0]
	if u > 0:
		return 1
	elif u < 0:
		return -1
	else:
		return 0

dat.sort(key=cmp_to_key(fraccomp))

#print(dat)

ans = 0
for i in range(n-1,-1,-1):
	ans = (dat[i][0] + (dat[i][1]+1) * ans) % mod

print(ans)
0