Submission #7383773


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 Java8 (OpenJDK 1.8.0)
Score 0
Code Size 364 Byte
Status CE

Compile Error

./Main.java:1: error: '.' expected
import sys
          ^
./Main.java:3: error: ';' expected
stdin = sys.stdin
     ^
./Main.java:7: error: illegal character: '#'
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
                                        ^
3 errors