結果

問題 No.2008 Super Worker
ユーザー simansiman
提出日時 2022-07-16 16:49:19
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 272 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 11,516 KB
実行使用メモリ 151,124 KB
最終ジャッジ日時 2023-09-11 02:03:45
合計ジャッジ時間 7,096 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
19,576 KB
testcase_01 AC 84 ms
14,972 KB
testcase_02 AC 83 ms
15,192 KB
testcase_03 AC 83 ms
15,100 KB
testcase_04 AC 83 ms
14,976 KB
testcase_05 AC 83 ms
15,260 KB
testcase_06 AC 83 ms
15,048 KB
testcase_07 AC 83 ms
15,180 KB
testcase_08 AC 83 ms
15,216 KB
testcase_09 AC 83 ms
15,192 KB
testcase_10 AC 83 ms
15,264 KB
testcase_11 AC 84 ms
15,100 KB
testcase_12 AC 82 ms
15,044 KB
testcase_13 AC 90 ms
16,504 KB
testcase_14 AC 93 ms
17,824 KB
testcase_15 AC 91 ms
16,596 KB
testcase_16 AC 93 ms
17,088 KB
testcase_17 AC 94 ms
17,208 KB
testcase_18 AC 120 ms
30,300 KB
testcase_19 AC 94 ms
19,924 KB
testcase_20 AC 100 ms
20,592 KB
testcase_21 AC 100 ms
20,520 KB
testcase_22 AC 97 ms
19,664 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - a_sum
Main.rb:7: warning: assigned but unused variable - b_sum
Syntax OK

ソースコード

diff #

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

a_sum = A.sum
b_sum = B.sum

C = A.zip(B)
C.sort_by! { |a, b| (b - 1.0) / a }
C.reverse!

ans = 0
level = 1

C.each do |a, b|
  ans += level * a
  ans %= MOD
  level *= b
end

puts ans
0