結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,304 KB
testcase_01 AC 80 ms
15,224 KB
testcase_02 AC 82 ms
15,216 KB
testcase_03 AC 81 ms
15,140 KB
testcase_04 AC 81 ms
15,152 KB
testcase_05 AC 81 ms
15,220 KB
testcase_06 AC 82 ms
15,296 KB
testcase_07 AC 81 ms
15,112 KB
testcase_08 AC 81 ms
15,220 KB
testcase_09 AC 81 ms
15,144 KB
testcase_10 AC 80 ms
15,012 KB
testcase_11 AC 80 ms
15,012 KB
testcase_12 AC 81 ms
15,164 KB
testcase_13 AC 89 ms
16,216 KB
testcase_14 AC 92 ms
17,532 KB
testcase_15 AC 89 ms
16,592 KB
testcase_16 AC 90 ms
17,076 KB
testcase_17 AC 90 ms
17,528 KB
testcase_18 AC 118 ms
30,088 KB
testcase_19 AC 93 ms
18,948 KB
testcase_20 AC 97 ms
20,576 KB
testcase_21 AC 97 ms
21,016 KB
testcase_22 AC 94 ms
18,740 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| Rational(b - 1, a) }
C.reverse!

ans = 0
level = 1

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

puts ans
0