Submission #6686247


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()
h = na()

prev = 999999999999
for i in range(n-1,-1,-1):
    if h[i] > prev:
        h[i] -= 1
    if h[i] > prev:
        print("No")
        sys.exit(0)
    prev = h[i]
print("Yes")

Submission Info

Submission Time
Task C - Build Stairs
User uwi
Language Python (3.4.3)
Score 300
Code Size 385 Byte
Status AC
Exec Time 75 ms
Memory 14812 KB

Judge Result

Set Name All Sample
Score / Max Score 300 / 300 0 / 0
Status
AC × 17
AC × 4
Set Name Test Cases
All sample_01, sample_02, sample_03, sample_04, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13
Sample sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 AC 17 ms 3064 KB
sample_02 AC 17 ms 3064 KB
sample_03 AC 17 ms 3060 KB
sample_04 AC 17 ms 3060 KB
testcase_01 AC 31 ms 9684 KB
testcase_02 AC 42 ms 14172 KB
testcase_03 AC 67 ms 13328 KB
testcase_04 AC 75 ms 14096 KB
testcase_05 AC 27 ms 6348 KB
testcase_06 AC 30 ms 8140 KB
testcase_07 AC 53 ms 14812 KB
testcase_08 AC 69 ms 13308 KB
testcase_09 AC 39 ms 13180 KB
testcase_10 AC 41 ms 14168 KB
testcase_11 AC 64 ms 14168 KB
testcase_12 AC 17 ms 3064 KB
testcase_13 AC 67 ms 14372 KB