Submission #7383870


Source Code Expand

Copy
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
b = na()

ans = 0
for i in range(n):
    q = 999999999
    if i > 0:
        q = min(q, b[i-1])
    if i < n-1:
        q = min(q, b[i])
    ans += q
print(ans)

Submission Info

Submission Time
Task C - Maximal Value
User uwi
Language Python (3.4.3)
Score 300
Code Size 364 Byte
Status AC
Exec Time 17 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample00, sample01, sample02
All handmade03, handmade04, handmade05, handmade06, handmade07, handmade08, handmade09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 AC 17 ms 3064 KB
handmade04 AC 17 ms 3060 KB
handmade05 AC 17 ms 3060 KB
handmade06 AC 17 ms 3064 KB
handmade07 AC 17 ms 3060 KB
handmade08 AC 17 ms 3064 KB
handmade09 AC 17 ms 3060 KB
random10 AC 17 ms 3064 KB
random11 AC 17 ms 3060 KB
random12 AC 17 ms 3064 KB
random13 AC 17 ms 2940 KB
random14 AC 17 ms 3064 KB
sample00 AC 17 ms 3060 KB
sample01 AC 17 ms 3064 KB
sample02 AC 17 ms 3060 KB