Problem:


Score : 200 points

Problem Statement

There are N mountains ranging from east to west, and an ocean to the west.

At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.

The height of the i-th mountain from the west is H_i.

You can certainly see the ocean from the inn at the top of the westmost mountain.

For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.

From how many of these N inns can you see the ocean?

Constraints

All values in input are integers.

1 \leq N \leq 20

1 \leq H_i \leq 100

Input

Input is given from Standard Input in the following format:

N
H_1 H_2 ... H_N

Output

Print the number of inns from which you can see the ocean.

Sample Input 1

4
6 5 6 8

Sample Output 1

3

You can see the ocean from the first, third and fourth inns from the west.

Sample Input 2

5
4 5 3 5 4

Sample Output 2

3

Sample Input 3

5
9 5 6 8 4

Sample Output 3

1



Sample input:
4
6 5 6 8


Sample output:
3

Submission status: Accepted

Solution code:
n = int(input())

h = list(map(int,input().split()))

ans = 1

for i in range(1,n):
	if max(h[0:i]) <= h[i]:
		#print(i)
		ans = ans + 1

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(N, hs):
    """Test Case
    >>> print_ans(4, [6, 5, 6, 8])
    3
    >>> print_ans(5, [4, 5, 3, 5, 4])
    3
    >>> print_ans(5, [9, 5, 6, 8, 4])
    1
    """
    ans = 0
    tmp_max = 0
    for h in hs:
        if h >= tmp_max:
            ans +=1
        tmp_max = max(tmp_max, h)
    print(ans)

if __name__ == '__main__':
    N = int(input().rstrip())
    hs = list(map(int, input().rstrip().split()))
    print_ans(N, hs)

Submission status: Accepted

Solution code:
N = int(input())
H_list = list(map(int,input().split()))

cnt =0
highest = 0

for i in range(N):
    if H_list[i] >= highest:
        cnt +=1
        highest = H_list[i]

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))

count = 1
for idx, h in enumerate(H):
    if idx == 0:
        continue
    else:
        if max(H[:idx]) <= h:
            count += 1
print(count)

Submission status: Accepted

Solution code:
can_see = 0
N = int(input())
H = map(int, input().split())
highest = 0
for i in H:
    if i >= highest:
        can_see += 1
        highest = i
print(can_see)

Submission status: Accepted

Solution code:
n=int(input())
b=0
c=0
for h in map(int,input().split()):
  if b<=h:
    b=h
    c+=1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
Hn = list(map(int,input().split(' ')))
current_max = 0
amount_count = 0
for val in Hn:
    if current_max <= val:
        current_max = val
        amount_count += 1
print(amount_count)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
ans = 0
pre = h[0]
for i in range(n):
  if pre <= h[i]:
    ans += 1
  pre = max(pre,h[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ls_h = list(map(int, input().split()))

cnt = 0
hmax = 0

for i in range(n):
    if ls_h[i] >= hmax:
        hmax = ls_h[i]
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
H=list(map(int,input().split()))
summary=1

for i in range(1,N):
    flag=1
    for j in range(i):
        if H[j]>H[i]:
            flag=0
    if flag==1:
        summary=summary+1

print(summary)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
MAX = h[0]
for i in h[1:]:
  if i >= MAX:
    ans += 1
    MAX = i
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))

ans=0

for i in range(n):
  a = h[:i+1]
  if not h[i] < max(a):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
ans = 1
for i in range(1,n):
    if max(h[:i])<=h[i]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
max = 0
cnt = 0
for i in range(n):
    if h[i] >= max:
        cnt += 1
        max = h[i]
    else:
        continue
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
H=list(map(int,input().split(' ')))

count=0
max_=0
for h in H:
  if h>=max_:
    count+=1
    max_=h

print(count)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
m = 0

for i in range(1, n, 1):
    m = max(m, h[i - 1])
    if (m <= h[i]):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
hn = list(map(int, input().split()))

count = 1
for i in range(1, n):
    flag = True
    for j in range(0, i):
        if hn[i] < hn[j]:
            flag = False
    if flag:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
H = [int(i) for i in input().split()]
ans = 1
for i in range(1, N):
    for j in range(i):
        if H[i] < H[j]:
            break
    else :
        ans += 1

print(ans)

Submission status: Accepted

Solution code:

n = int(input())
h = list(map(int, input().split()))


max_h = [0]*n
max_h[0]=h[0]
for i in range(1,n):
  max_h[i] = max(max_h[i-1],h[i])

count=1
for i in range(1,n):
  if max_h[i-1]<=h[i]:
    count+=1
    

print(count)

Submission status: Accepted

Solution code:
# ABC 124: B – Great Ocean View
n = int(input())
h = [int(s) for s in input().split()]

number_inns_can_see_ocean = 0
highest = h[0]

for height_of_inn in h:
    if height_of_inn >= highest:
        number_inns_can_see_ocean += 1
        highest = height_of_inn

print(number_inns_can_see_ocean)

Submission status: Accepted

Solution code:
N = int(input())
H = list( map(int, input().split()) )

cnt = 1
for i in range(1, N):
    flg = 1
    for j in range(i):
        if H[i] < H[j]:
            flg = 0
    if flg:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int , input().split()))

can_see_ocean = 0

for i in range(N):
    compare_high = H[0:i+1]
    if max(compare_high) == H[i]:
        can_see_ocean += 1
        
print(can_see_ocean)

Submission status: Accepted

Solution code:
N = int(input())
H = input().split()
H = [int(h) for h in H]

max_ = H[0]
count = 0

for i in range(N):
    if(H[i]>=max_):
        count += 1
    max_ = max([max_,H[i]])
    
print(count)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF = 10**18


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    H = list(map(int, input().split()))
    ans = 1
    for i in range(N):
        for j in range(i):
            if H[j] > H[i]:
                break
            if i == j+1:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))

re = 1
M = h[0]

for i in range(1,n):
    if M <= h[i]:
        re += 1
    M = max(M,h[i])
    
print(re)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

cnt = n
for i in reversed(range(n)):
    for j in reversed(range(i)):
        if h[i] < h[j]:
            cnt-=1
            break
        
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = [0] + list(map(int, input().split()))
ans = 0

for i in range(1, n+1):
    if h[i] == max(h[:i+1]):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
count,ans = 0,0
for i in H:
    if count <= i:
        count = i
        ans = ans + 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
res = 0
for i in range(n):
    f = 0
    for j in range(i):
        if h[i]>=h[j]:
            f += 1
    if f == i:
        res += 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

ans = 1
num = h[0]

for i in range(1, n):
  if h[i] >= num:
    num = h[i]
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
# 2019-11-13 01:34:25(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *h = [int(x) for x in sys.stdin.read().split()]

    count = 0
    for i in range(n):
        if max(h[:i+1]) <= h[i]:
            count += 1

    print(count)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = input()
    s = input()
    raw_list = list(map(int, s.split()))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
h_list = list(map(int, input().split()))

ans = 1
for i in range(N-1):
    if h_list[i] <= h_list[i+1]:
        ans += 1
    else:
        h_list[i+1] = h_list[i]

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
cnt=0
maxi=0
for x,i in enumerate(h):
    maxi=max(maxi,h[x])
    if i>=maxi:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
ans = 0
mx = -1
for i in range(n):
    if(mx<=h[i]):
        mx = h[i]
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
cnt=0
for x,i in enumerate(h):
    if i == max(h[:x+1]):
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

cnt = 0
maxh = 0
for i in range(0, n):
  if h[i] >= maxh:
    cnt += 1
    maxh = h[i]

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

count = 1
max = 0
for i in range(n-1):
    if max < h[i]:
        max = h[i]

    if max <= h[i+1]:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
hl = list(map(int,input().split()))	

ans = 0
tmp = 0
for h in hl:
    if h >= tmp:
        tmp = h
        ans +=1 

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
ans=1
max=h[0]
for i in range(1,n):
  if h[i]>=max:
    max=h[i]
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
hs = list(map(int, input().split()))
a = 0
for i in range(n):
    if i == 0:
        a += 1
    else:
        if max(hs[0:i]) <= hs[i]:
            a += 1
print(a)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
tmp = h[0]
for i in range(1,n):
    if tmp <= h[i]:
          ans += 1
          tmp = h[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
high = list(map(int,input().split()))
count = 0
a = []

for i in range(1,N):
  a=[]
  for j in range(i):
    if high[i]-high[j]>=0:
      a.append(high[j])
  else:
    if len(a) == i:
      count += 1

print(count+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))
sum = 1
for i in range(1, N):
  max_hight = np.max(H[:i])
  if(H[i] >= max_hight):
    sum += 1

print(sum)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
x=0
count=0
for i in range(n):
  if x<=h[i]:
    x=h[i]
    count+=1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
count=0
flag=1
for i in range(n):
  if max(h[:(i+1)])==h[:(i+1)][-1]:
    count+=1
print(count)

Submission status: Accepted

Solution code:
s = int(input())
a = list(map(int,input().split()))
cnt = 0
b = 0
for i in range(s):
  if a[i] >= b:
    b = a[i]
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))

ans = 1
height = H[0]
for i in range(1, N):
    if height <= H[i]:
        ans += 1
        height = H[i]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
c = 1
for i in range(1, n):
  if h[i] >= max(h[:i]):
    c += 1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
L = [H[0]]
count = 1
for i in range(1,len(H)):
  L.append(H[i])
  if max(L) == L[-1]:
    count += 1
    
print(count)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
ans = 1
for i in range(1,N):
  for j in range(i):
    if H[i] < H[j]:
      break
    if j == i-1:
      ans +=1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
a=0
b=0
for i in range(n):
  a=max(a,h[i])
  if h[i]==a:
    b=b+1
print(b)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
a=0
b=0
for i in range(n):
  a=max(a,h[i])
  if h[i]==a:
    b=b+1
print(b)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(h[-(i+1)])
#print(a)
s=0
#print(max(a[2:]))
for i in range(n):
    if a[i]>=max(a[i:]):
        s+=1
print(s)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
x=1
m=h[0]
for i in range(1,n):
  if h[i]>=m:
    x+=1
    m=h[i]
print(x)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
prev = 0
ans = 0
for i in h:
    if i >= prev:
        ans += 1
    prev = max(prev, i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = [int(item) for item in input().split()]
 
c = 0 #count
 
for i in range(n):
  flag=0
  if i==0:
    pass
  else:
    for j in range(i):
      if h[j] > h[i]:
        flag=1
        break
  if flag == 0:
    c+=1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
H = list(map(int, input().split()))
cnt = 0

for i in range(n):
    if max(H[:i+1]) <= H[i]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
templist = [0]
ans = 0

for i in range(N):
  templist.append(H[i])
  if H[i] >= max(templist):
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
count = 0
M = 0
for i in range(N):
  if H[i]>=M:
    count += 1
    M = H[i]
print(count)

Submission status: Accepted

Solution code:
def convert(arr):
    H = []
    for value in arr:
        H.append(int(value))
    return H


def tellTop(i, arr):
    for index in range(i):
        if arr[index] > arr[i]:
            return False
    return True


def count(arr):
    count = 0

    for i in range(0,len(arr)):
        if tellTop(i, arr):
            count = count + 1

    return count


N = input()
arrH = input().split(' ')
N = int(N)
H = convert(arrH)

print(count(H))

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
pre = H[0]
count = 1
for i in range(N-1):
    if pre <= H[i+1]:
        count += 1
        pre = H[i+1]
print(count)

Submission status: Accepted

Solution code:
n = int(input())
h = [int(i) for i in input().split()]
cnt = 0
for i in range(n):
    for j in range(i):
        if h[i] < h[j]:
            break
    else:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
H=list(map(int,input().split()))
result=0
H_max=H[0]
for i in range(len(H)):
  if H[i]>=H_max:
    result +=1
    H_max=H[i]
print(result)

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = 0
tmp = li[0]
for num in li:
    if(num >= tmp):
        tmp = num
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    H = list(map(int,input().split()))

    count = 0
    maximum = 0
    for i in range(n):
        if H[i] >= maximum:
            maximum = max(maximum,H[i])
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
ans = 0
max_h = 0
for i in range(n):
  if max_h <= h[i]:
    ans += 1
    max_h = h[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = map(int, input().split()[0:])

mx = 0
ans = 0

for h in H:
	if mx <= h: ans += 1
	mx = max(mx, h)

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
point = 1
ma = li[0]
for i in range(1,n):
    if li[i] >= ma:
        point += 1
        ma = li[i]
print(point)

Submission status: Accepted

Solution code:
n = int(input())
hs = list(map(int, input().split()))

maxs = hs[0]
count = 1
for h in hs[1:]:
  if h >= maxs:
    maxs = h
    count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
cnt = 0
h = [H[0]]
for i in range(1, N):
    if max(h) <= H[i]:
        cnt += 1
    h.append(H[i])
print(cnt + 1)

Submission status: Accepted

Solution code:
n = int(input())
list1 = list(map(int,input().split()))
count = 1
the_lowrst = list1[0]
if n == 1:
    print(1)
    exit()
for i in range(1,n):
    if the_lowrst <= list1[i]:
        the_lowrst = list1[i]
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

tmp_max = h[0]
count = 1

for i in range(1, len(h)) :
    if tmp_max <= h[i] :
        count += 1
        tmp_max =  h[i]

print(count)

Submission status: Accepted

Solution code:
def main(n, h):
    base = 0
    count = 0

    for _h in h:
        if _h >= base:
            base = _h
            count += 1

    print(count)


if __name__ == "__main__":
    n = int(input())
    h = list(map(int, input().split(' ')))

    main(n, h)

Submission status: Accepted

Solution code:
N= int(input())
H = list(map(int,input().split()))
aH = [max(H[:i]) for i in range(1,N+1)]
ans=0
for i,e in zip(H,aH):
    if  i>=e : ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = [int(x) for x in input().split()]

ans=0
MAX_H=H[0]

for i in range(N):
    if H[i] >= MAX_H:
        ans+=1
        MAX_H = H[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
cnt = 0
pre = 0
for x in H:
   if pre <= x:
      cnt+=1
      pre = x
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
count = 1
hi = h[0]
for i in range(1, n):
    if hi <= h[i]:
        hi = h[i]
        count += 1
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    N = int(input())
    Hs = [int(s) for s in input().split()]
    result = 0
    for i, ryokan in enumerate(Hs):
        for i2, syougai in enumerate(Hs):
            if i2 == i:
                result += 1
                break
            if ryokan < syougai:
                break
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
h=input().split()
for i in range(n):
    h[i]=int(h[i])
ans=1
x=[]
x.append(h[0])
for j in range(1,n):
    if h[j]>=max(x):
        ans+=1
    x.append(h[j])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))

ans = 1

for n in range(1,N):
    if H[n] >= max(H[:n]):
        ans +=1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H_list = [int(x) for x in input().split()]
cnt = 1
for i, H in enumerate(H_list):
    if (i==0): continue
    visible = True
    for j in range(i):
        if (H_list[j] > H):
            visible = False
            break
    if (visible):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
print(len([h[i] for i in range(n) if h[i] >= max(h[:i+1])]))

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

cnt = 1
for i in range(1, n):
	now = h[i]
	jud = 0
	for j in range(i):
		if now < h[j]:
			jud = 1
			break
	if jud == 0:
		cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = input().split()
a = int(h[0])
b = 0

for i in range(n):
    if a <= int(h[i]):
        a = int(h[i])
        b += 1
        
print(b)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
highest = 0
count = 0
for i in range(n):
    if h[i] >= highest:
        highest = h[i]
        count += 1
print(count)

Submission status: Accepted

Solution code:
n= int(input())
h= list(map(int, input().split()))
cnt=1
a=h[0]
for i in range(1,n):
    if a<=h[i]:
        cnt+=1
        a=h[i]
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))

con = 0

for i in range(N):
	for j in range(i):
		if H[i] < H[j]:
			break
	else:
		con += 1


print(con)

Submission status: Accepted

Solution code:
N = int(input())
hill = list(map(int, input().split()))
view = 0
f = False
highest = hill[0]
for i in range(N):
    if hill[i] >= highest:
        f = True
        highest = hill[i]
    else:
        f = False
    if f:
        view += 1
print(view)

Submission status: Accepted

Solution code:
n = int(input())
h_L = list(map(int,input().split()))

h_L.append(0)

count = 0
for i in range(1,n):
    tmp_L = h_L[0:i+1]
    if h_L[i] == sorted(tmp_L)[-1]:
        count +=1

print(count+1)

Submission status: Accepted

Solution code:
N = int(input())
H1 = list(map(int,input().split()))
H2 = [0]*(N)
total = 0
for i in range(N):
    H2[i] = H1[i]
    if H1[i] >= max(H2):
        total += 1
print(total)

Submission status: Accepted

Solution code:
n = int(input())
H = list(map(int, input().split()))

ans = 0
max_h = 0
for h in H:
    if h >= max_h:
        ans += 1
        max_h = h

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in H[:i]:
        if j <= H[i]:
            pass
        else:
            break
    else:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
c = 1
for i in range(1,n):
    if h[i] >= max(h[:i]):
        c += 1
print(c)

Submission status: Accepted

Solution code:
n=int(input())
x=list(map(int,input().split()))
count=1
for i in range(1,n):
  xcount=0
  for j in range(0,i):
    if x[i] < x[j]:
      xcount=1
  if xcount == 0:
    count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(int, input().strip().split()))

top = s[0]
cnt = 0
for i in range(n):
    if(s[i] >= top):
        top = s[i]
        cnt += 1


print (cnt)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
    if max(h[0:i+1])==h[i]:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
listh = [int(i) for i in input().split()]

ans=1

temp=listh[0]
if n>=2:
	for i in range(1,n):
		if temp<=listh[i]:
			ans=ans+1
			temp=listh[i]
	#		print(temp)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
H=h[0]
count=0
for i in range(n):
    if H<=h[i]:
        count+=1
        H=h[i]
print(count)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))

c = 0
for i in range(n):
    if i == 0:
        c += 1
    elif h[i] >= max(h[0:i]):
        c += 1

print(c)

Submission status: Accepted

Solution code:
N = int(input())
H = [int(x) for x in input().split()]
ans = 0
height = 0
for i in range(N):
    if height <= H[i]:
        ans += 1
        height = H[i]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = [int(i) for i in input().split()] 
max=0
ans=0

for i in h:
    if i >= max:

        ans+=1
        max=i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))

R = 1
h = H[0]

for i in range(1, N):
    if h <= H[i]:
        R += 1
        h  = H[i]

print(R)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
cnt = 1
height = H[0]
for val in H[1:]:
    if height <= val:
        cnt += 1
        height = val
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
s = [int(i) for i in input().split()]
ans = n

for i in range(1,n):
    temp = s[i]
    for j in range(i):
        if(s[j] > temp):
            ans -= 1
            break
        
        
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
X=[int(i) for i in input().split()]
ans=1
for i in range(1,N):
    if X[i] >= max(X[0:i]): ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
count = 1
for i in range(1,N):
    if max(H[:i]) <= H[i]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
cnt = 0
for e in map(int, input().split()):
    if e >= cnt:
        ans += 1
        cnt = e
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))

# highest_height[i]は西から0,1,...,i番目のうち最も高い山の高さ
highest_height = [H[0]]
for i in range(1,N):
    highest_height.append(max(highest_height[-1],H[i]))

ans = 0
for i in range(N):
    if H[i] >= highest_height[i]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
ans = 1

for i in range (1,N):
  if max(H[0:i]) <= H[i]:
    ans = ans + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))

ans = 0
max_H = 0
for h in H:
  if h >= max_H:
    max_H = h
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
H=list(map(int,input().split()))
ans=0
hM=1
for hi in H:
    hM=max(hM,hi)
    if hM==hi:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
L = list(map(int, input().split()))
cnt = 1
for i in range(1,n):
  if not L[i] < max(L[:i]):
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
    f = True
    for j in range(i):
        f = f and H[j]<=H[i]
    if f:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = input()
h_list = [int(i) for i in input().split()]

h_0 = h_list[0]
count = 0
west = [0]

for i in h_list:
    if i >= h_0 and i >= max(west):
        count += 1
    h_0 = i
    west.append(i)

print(count)

Submission status: Accepted

Solution code:
#ABC124B
N = int(input())
H = list(map(int, input().split()))
maxH = H[0]
ans = 1
for i in range(1,N):
    if maxH <= H[i]:
        ans += 1
        maxH = H[i]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))	
M=h[0]
ans=1
for i in range(n-1):
    i+=1
    if M<h[i-1]:
        M=h[i-1]
    if M<=h[i]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
H = [int(h) for h in input().split()]
ans = 1
for i in range(1, n):
    for j in range(i):
        if H[j] > H[i]: break
        if j == i - 1: ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
ans=1
x=h[0]
for i in range(n-1):
  if x<=h[i+1]:
    ans+=1
    x=h[i+1]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
if N == 1:
  print(1)
  exit()
ans = 1
MAX = H[0]
for i in range(1,N):
  if H[i] >= MAX:
    ans += 1
  MAX = max(MAX,H[i])
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
H=list(map(int,input().split()))
ans = 1
for i in range(1,N):
    tmp = True
    for j in range(0,i):
        if H[j]>H[i]:
            tmp = False
            break
    if tmp:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from itertools import accumulate

n = int(input())
h = list(map(int, input().split()))

max_h = list(accumulate(h, max))


print(sum([1 for h, m in zip(h, max_h) if h == m]))

Submission status: Accepted

Solution code:
N=int(input())
H=[int(i) for i in input().split()]
k=0
l=0
for j in range(N):
    if H[l]<=H[j]:
        k+=1
        l=j
print(k)

Submission status: Accepted

Solution code:
n = int(input())
h = [int(_) for _ in input().split()]
ans = 1
takai = h[0]
for i in range(1,n):
    if h[i] >= takai:
        takai = h[i]
        ans += 1
    else:
        pass
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
ans = 1
m = h[0]
for i in range(n-1):
    if h[i] <= h[i+1] and h[i+1] >= m:
        ans += 1
        m = h[i+1]
print(ans)

Submission status: Accepted

Solution code:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    HS = list(map(int, input().split()))
    ans = 1
    last = HS[0]
    for h in HS[1:]:
        if h >= last:
            last = h
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
hs = list(map(int,input().split()))
count = 1
for i in range(1,n):
  target = hs[i]
  if max(hs[0:i+1]) == target:
    count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
tmp = 0
for i in a:
    if tmp <= i:
        ans += 1
    tmp = max(i, tmp)
print(ans)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    h = list(map(int, input().rstrip('\n').split()))
    mh = 0
    cnt = 0
    for v in h:
        if v >= mh:
            cnt += 1
        mh = max(mh, v)
    print(cnt)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
n = int(input())
h = [int(_) for _ in input().split()]
first = h[0]
cnt =1
for i in range(n-1):
  if h[i+1] >= first:
    first = h[i+1]
    cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int, input().split()))
ans=1
b=0
for i in range(1,n):
        b=max(h[j] for j in range(i))
        if b<=h[i]:
            ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int, input().split()))
ans=1
b=[0]*n
b[0]=h[0]
for i in range(1,n):
    if max(b)<=h[i]:
        ans+=1
        b[i]=h[i]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int, input().split()))
ans=1
b=h[0]
for i in range(1,n):
        b=max(b,h[i-1])
        if b<=h[i]:
            ans+=1
print(ans)