Submission #4244667
Source Code Expand
n = int(input())
heights = list(map(int, input().split()))
maximum = max(heights)
splits = 0
for h in range(maximum, 0, -1):
before = None
sp = 0
for i, _ in enumerate(heights):
if heights[i] == h:
if before != i - 1:
sp += 1
before = i
heights[i] -= 1
# print('height', h, ':', sp)
splits += sp
print(splits)
Submission Info
| Submission Time | |
|---|---|
| Task | C - Grand Garden |
| User | cocodrips |
| Language | Python (3.4.3) |
| Score | 300 |
| Code Size | 410 Byte |
| Status | AC |
| Exec Time | 19 ms |
| Memory | 3064 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.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, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 17 ms | 3064 KiB |
| 02.txt | AC | 17 ms | 3060 KiB |
| 03.txt | AC | 17 ms | 3064 KiB |
| 04.txt | AC | 17 ms | 3060 KiB |
| 05.txt | AC | 17 ms | 2940 KiB |
| 06.txt | AC | 18 ms | 3060 KiB |
| 07.txt | AC | 18 ms | 3064 KiB |
| 08.txt | AC | 17 ms | 3060 KiB |
| 09.txt | AC | 19 ms | 3060 KiB |
| 10.txt | AC | 19 ms | 3060 KiB |
| 11.txt | AC | 19 ms | 3060 KiB |
| 12.txt | AC | 19 ms | 3060 KiB |
| 13.txt | AC | 19 ms | 3060 KiB |
| 14.txt | AC | 19 ms | 2940 KiB |
| 15.txt | AC | 19 ms | 3060 KiB |
| 16.txt | AC | 17 ms | 3060 KiB |
| s1.txt | AC | 17 ms | 3064 KiB |
| s2.txt | AC | 17 ms | 3060 KiB |
| s3.txt | AC | 17 ms | 3060 KiB |