Submission #1211803


Source Code Expand

Copy
#!/usr/bin/ruby
n,m=gets.split.map &:to_i
a=gets.split.map(&:to_i).sort.map.with_index{|e,i|e*(2*i+1-n)}.reduce(:+)
b=gets.split.map(&:to_i).sort.map.with_index{|e,i|e*(2*i+1-m)}.reduce(:+)
p a*b%(10**9+7)

Submission Info

Submission Time
Task D - 井井井 / ###
User leafmoon
Language Ruby (2.3.3)
Score 500
Code Size 209 Byte
Status
Exec Time 136 ms
Memory 19816 KB

Compile Error

./Main.rb:2: warning: `&' interpreted as argument prefix

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 500 / 500 0_000.txt, 0_001.txt, max.txt, min.txt, mod.txt, n2.txt, rndA.txt, rndB.txt, rndC.txt, rndD.txt, rndE.txt, rndF.txt, rndG.txt, rndH.txt, rndI.txt, rndJ.txt, var.txt
Case Name Status Exec Time Memory
0_000.txt 7 ms 1788 KB
0_001.txt 7 ms 1788 KB
max.txt 135 ms 17896 KB
min.txt 7 ms 1788 KB
mod.txt 74 ms 10104 KB
n2.txt 73 ms 10104 KB
rndA.txt 133 ms 17768 KB
rndB.txt 134 ms 17768 KB
rndC.txt 134 ms 17768 KB
rndD.txt 133 ms 17768 KB
rndE.txt 134 ms 17768 KB
rndF.txt 133 ms 17768 KB
rndG.txt 136 ms 17768 KB
rndH.txt 135 ms 17768 KB
rndI.txt 134 ms 17768 KB
rndJ.txt 134 ms 19816 KB
var.txt 134 ms 17768 KB