# 보이는 트로피의 수 => 최대값이 갱신되는 횟수 카운팅
def search(N, heights):
cnt = 0
max_v = -1e9
for x in heights:
if x > max_v:
max_v = x
cnt += 1
return cnt
N = int(input())
heights = [int(input()) for _ in range(N)]
print(search(N, heights))
print(search(N, list(reversed(heights))))
'BOJ 알고리즘 (패캠) > 정렬, 탐색' 카테고리의 다른 글
2110번: 공유기 설치 (탐색, 이분탐색) - Fastcampus (0) | 2020.10.07 |
---|---|
1236번: 성 지키기 (탐색) - Fastcampus (0) | 2020.10.06 |
1302번: 베스트셀러 (탐색) - Fastcampus (0) | 2020.10.06 |
1568번: 새 (탐색) - Fastcampus (0) | 2020.10.06 |
1543번: 문서 검색 (탐색) - Fastcampus (0) | 2020.10.06 |