結果

問題 No.2008 Super Worker
ユーザー maguroflymagurofly
提出日時 2022-07-15 22:19:41
言語 Ruby
(3.3.0)
結果
AC  
実行時間 803 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 11,496 KB
実行使用メモリ 44,892 KB
最終ジャッジ日時 2023-09-10 02:33:25
合計ジャッジ時間 14,302 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,180 KB
testcase_01 AC 78 ms
15,112 KB
testcase_02 AC 79 ms
15,232 KB
testcase_03 AC 79 ms
15,012 KB
testcase_04 AC 79 ms
15,276 KB
testcase_05 AC 80 ms
15,336 KB
testcase_06 AC 81 ms
15,248 KB
testcase_07 AC 80 ms
15,228 KB
testcase_08 AC 80 ms
15,244 KB
testcase_09 AC 80 ms
15,084 KB
testcase_10 AC 79 ms
15,276 KB
testcase_11 AC 79 ms
15,060 KB
testcase_12 AC 79 ms
15,016 KB
testcase_13 AC 81 ms
15,284 KB
testcase_14 AC 84 ms
15,112 KB
testcase_15 AC 83 ms
15,248 KB
testcase_16 AC 83 ms
15,116 KB
testcase_17 AC 85 ms
15,080 KB
testcase_18 AC 86 ms
15,160 KB
testcase_19 AC 83 ms
15,020 KB
testcase_20 AC 84 ms
15,204 KB
testcase_21 AC 84 ms
15,244 KB
testcase_22 AC 84 ms
15,280 KB
testcase_23 AC 795 ms
43,528 KB
testcase_24 AC 791 ms
43,540 KB
testcase_25 AC 800 ms
43,380 KB
testcase_26 AC 791 ms
43,228 KB
testcase_27 AC 793 ms
43,476 KB
testcase_28 AC 801 ms
44,512 KB
testcase_29 AC 800 ms
44,640 KB
testcase_30 AC 803 ms
44,516 KB
testcase_31 AC 798 ms
44,504 KB
testcase_32 AC 798 ms
44,416 KB
testcase_33 AC 507 ms
44,892 KB
testcase_34 AC 795 ms
44,548 KB
testcase_35 AC 497 ms
43,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
MOD = 10**9 + 7

works = A.zip(B)
works.sort! { |(a1, b1), (a2, b2)| a1 + b1 * a2 <=> a2 + b2 * a1 }
works.reverse!

ans = 0
x = 1
works.each do |a, b|
    ans += x * a
    ans %= MOD
    x = x * b % MOD
end

puts ans
0