Submission #1865365


Source Code Expand

n,k = gets.split.map &:to_i
a = gets.split.map(&:to_i).sort
ans = 0
k.times{|i| ans += a[i]}

p ans+(k-1)*k/2

Submission Info

Submission Time
Task B - オークション
User sca1l
Language Ruby (2.3.3)
Score 200
Code Size 114 Byte
Status AC
Exec Time 73 ms
Memory 10096 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix
./Main.rb:1: warning: assigned but unused variable - n

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 73 ms 9984 KB
in10.txt AC 66 ms 9984 KB
in11.txt AC 66 ms 9984 KB
in12.txt AC 65 ms 10096 KB
in13.txt AC 7 ms 1788 KB
in2.txt AC 65 ms 10096 KB
in3.txt AC 65 ms 9984 KB
in4.txt AC 65 ms 9984 KB
in5.txt AC 65 ms 10096 KB
in6.txt AC 65 ms 9984 KB
in7.txt AC 71 ms 10096 KB
in8.txt AC 67 ms 10096 KB
in9.txt AC 65 ms 10096 KB
sample1.txt AC 7 ms 1788 KB
sample2.txt AC 7 ms 1788 KB