Submission #3260206
Source Code Expand
n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) a = a.unshift(0).push(0) s = 0 (n + 1).times{|i| s += (a[i + 1] - a[i]).abs} n.times do |i| s_i = s + (a[i] - a[i + 2]).abs - (a[i] - a[i + 1]).abs - (a[i + 1] - a[i + 2]).abs puts s_i.to_s end
Submission Info
Submission Time | |
---|---|
Task | C - Traveling Plan |
User | material |
Language | Ruby (2.3.3) |
Score | 300 |
Code Size | 269 Byte |
Status | AC |
Exec Time | 140 ms |
Memory | 12548 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 140 ms | 12548 KB |
02.txt | AC | 137 ms | 12548 KB |
03.txt | AC | 7 ms | 1788 KB |
04.txt | AC | 137 ms | 12548 KB |
05.txt | AC | 137 ms | 12548 KB |
06.txt | AC | 137 ms | 12548 KB |
07.txt | AC | 138 ms | 12548 KB |
08.txt | AC | 137 ms | 12548 KB |
09.txt | AC | 133 ms | 11908 KB |
10.txt | AC | 130 ms | 11908 KB |
11.txt | AC | 130 ms | 11908 KB |
12.txt | AC | 130 ms | 11908 KB |
sample-01.txt | AC | 7 ms | 1788 KB |
sample-02.txt | AC | 7 ms | 1788 KB |
sample-03.txt | AC | 7 ms | 1788 KB |