Submission #2407294


Source Code Expand

n, t=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)

tot=0
n.times do |i|
  if i+1<n
    if a[i+1]-a[i]<t
      tot+=(a[i+1]-a[i])
    else
      tot+=t
    end
  else
    tot+=t
  end
end

puts tot

Submission Info

Submission Time
Task C - Sentou
User ikd
Language Ruby (2.3.3)
Score 300
Code Size 215 Byte
Status AC
Exec Time 127 ms
Memory 16004 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 5
AC × 13
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, rand0, rand1, rand2, rand3, rand4
Case Name Status Exec Time Memory
example0 AC 7 ms 1788 KB
example1 AC 7 ms 1788 KB
example2 AC 7 ms 1788 KB
example3 AC 7 ms 1788 KB
example4 AC 7 ms 1788 KB
maxrand0 AC 127 ms 15876 KB
maxrand1 AC 127 ms 15876 KB
maxrand2 AC 117 ms 16004 KB
rand0 AC 7 ms 1788 KB
rand1 AC 7 ms 1788 KB
rand2 AC 7 ms 1788 KB
rand3 AC 7 ms 3836 KB
rand4 AC 7 ms 1788 KB