Submission #5075941
Source Code Expand
N = int(input()) A = [0] * (N + 2) for i, v in enumerate(input().split()): A[i+1] = int(v) num = sum([abs(A[i] - A[i+1]) for i in range(N+1)]) for i in range(1,N+1): ret = num + abs(A[i-1] - A[i+1]) - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1])) print(ret)
Submission Info
Submission Time | |
---|---|
Task | C - Traveling Plan |
User | ishigen |
Language | Python (3.4.3) |
Score | 300 |
Code Size | 272 Byte |
Status | AC |
Exec Time | 235 ms |
Memory | 14000 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 | 235 ms | 13228 KB |
02.txt | AC | 229 ms | 14000 KB |
03.txt | AC | 17 ms | 3064 KB |
04.txt | AC | 219 ms | 13892 KB |
05.txt | AC | 226 ms | 13228 KB |
06.txt | AC | 222 ms | 13228 KB |
07.txt | AC | 217 ms | 13232 KB |
08.txt | AC | 222 ms | 14000 KB |
09.txt | AC | 225 ms | 11760 KB |
10.txt | AC | 227 ms | 12256 KB |
11.txt | AC | 226 ms | 11768 KB |
12.txt | AC | 219 ms | 11896 KB |
sample-01.txt | AC | 18 ms | 3060 KB |
sample-02.txt | AC | 17 ms | 2940 KB |
sample-03.txt | AC | 17 ms | 2940 KB |