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:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

n = int(input())
h = list(myinput())

M = 0
count = 0
for i in range(n):
    if h[i]>=M:
        count += 1
        M = h[i]
    else:
        pass

print(count)

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 = [int(i) for i in input().split()]

count = 0
pre_max = 0
for h in H:
    if h >= pre_max:
        count += 1
        pre_max = h
print(count)

Submission status: Accepted

Solution code:
n,*h=map(int,open(0).read().split());print(sum(max(h[:x+1])==h[x]for x in range(n)))

Submission status: Accepted

Solution code:
n,h=int(input()),list(map(int,input().split()));print(sum(max(h[:x+1])==h[x]for x in range(n)))

Submission status: Accepted

Solution code:
import itertools
import math

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

k = -1
ans = 0
for i in a :
  if (k <= i):
    ans += 1
    k = i
         
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
 
pre = 0
ans = 0
 
for h in H:
  if h >= pre:
    pre = h
    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-1,-1,-1):
	cnt=0	
	for j in range(0,i):
		if H[i]<H[j]:
			cnt=1
	if cnt==0:
		res+=1

print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
hs = list(map(int,input().split()))
ans = 0
m = 0
for h in hs:
  if m <= h:
    ans += 1
  m = max(m, h)

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    cnt=1
    for i in range(1,n):
        if l[i]==max(l[:i+1]):
            cnt+=1
    print(cnt)
resolve()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    cnt=1
    for i in range(1,n):
        if l[i]>=max(l[:i]):
            cnt+=1
    print(cnt)
resolve()

Submission status: Accepted

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

tmp = H[0]
ans = 1
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())
h = list(map(int,input().split()))
ans = 1
x = h[0]
for i in range(1,n):
    if h[i] >= x:
        ans += 1
        x = h[i]
print(ans)

Submission status: Accepted

Solution code:
# ABC124B

n = int(input())
h = list(map(int, input().split()))
while True:
    removed = False
    for i in range(1, n):
        if i < len(h) and h[i-1] > h[i]:
            # print(f"removed {h[i]}")
            removed = True
            h.pop(i)
    if removed == False:
        break
print(len(h))

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    h = list(map(int, input().split()))
    res = 0
    m = 0
    for i in h:
        if i >= m:
            res += 1
            m = max(m, i)
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, *h = map(int, open(0).read().split())
m = h[0]
for i in range(n):
    if m > h[i]:
        n -= 1
    m = max(m, h[i])
print(n)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int,input().split()))
a = 0
t = 0
ans = 0
while t < n:
  if a <= h[t]:
    ans += 1
    a = h[t]
  t += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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]

print(cnt)

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]
print(cnt)

Submission status: Accepted

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

s = 1

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

Submission status: Accepted

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


for i in range(1, N):
  mieru = True
  for j in range (i):
    
   
    if H[i]<H[j]:
     
      mieru = False
      break
  if mieru == True:
    cnt += 1
   
    
print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

cnt = 1

for i in range(1, N):
  flag = True
  for h in range(i):
    if H[h] > H[i]:
      flag = False
      break
  if flag:
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

N=II()
H=LI()

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

Submission status: Accepted

Solution code:
def great_ocean_view(n, hli):

    ans = 0
    hlimax = hli[0]

    for i in hli:
        if hlimax <= i:
            ans += 1
            hlimax = i

    return ans

def main():
    n = int(input())
    hli = list(map(int, input().split()))
    print(great_ocean_view(n, hli))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
c_max=h[0]
ans=1
for i in range(1,n):
    if h[i]>=c_max:
        ans+=1
        c_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):
    h_h = sorted(h[:i+1])
    if h[i]==h_h[i]:
        ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
arr = [int(x) for x in input().split()]
ans = 1

cm = arr[0]

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

Submission status: Accepted

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

ans = 0
h_max = 0
for h in h_list:
    if h < h_max:
        continue
    ans += 1
    h_max = h
print(ans)

Submission status: Accepted

Solution code:

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
hmax = 0
ans = 0
for i in range(n):
    if h[i] >= hmax:
        ans += 1
        hmax = h[i]
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[0] <= h[i] and max_h <= h[i] and h[i] >= h[i-1]:
        ans += 1

    max_h = max(h[i],max_h)

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

count=0
s = 0
for i in range(len(h)-1):
  s = max(s,h[i])
  if s <= h[i+1]:
    count+=1
print(count+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
n = int(input())
li = list(map(int, input().split()))
cnt = 0
maximum = 0
for i in li:
    if (maximum <= i):
        cnt += 1
        maximum = i
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Great Ocean View

n = int(input())
h = list(int(x) for x in input().split())

ans = 0
tmp = 0
for i in range(n):
    if tmp <= h[i]:
        ans += 1
        tmp = h[i]
    else:
        continue

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
H = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)
ans = 0
max = H[0]
for h in H:
    if h >= max:
        ans += 1
        max = h
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

N = I()
H = LI()

ans = 0
m = H[0]
for h in H:
    m = max(m, h)

    if h >= m:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(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())
ls = [int(i) for i in input().split()]
maxx = ls[0]
inns = 0
for i in range(len(ls)):
    if ls[i] >= maxx:
        inns += 1
    if ls[i] > maxx:
        maxx =  ls[i]

print(inns)

Submission status: Accepted

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

ans,tmp_max = 1,H[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
h = [int(i) for i in 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()))
count = 1

lead = h[0]
for a in h[1:]:
    if lead <= a:
        lead = a
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, *h = map(int, open(0).read().split())

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

print(cnt)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

lead = H[0]
count = 1

for a in H[1:]:
    if lead <= a:
        lead = a
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
lst = list(map(int, input().split()))
cnt = 0

for i in range(N):
    if i == 0:
        cnt += 1
    else:
        canview = True
        for j in range(0, i):
            if lst[j] > lst[i]:
                canview = False
        if canview:
            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):
    if h[i] >= max(h[:i]):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()

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

print(ans)

Submission status: Accepted

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

count = 1

for i in range(1, len(H)):
    for j in range(i):
        if H[i] < H[j]:
            break
    else:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline

def main():
    N = int(input())
    H = list(map(int, readline().rstrip().split()))
    m = H[0]
    cnt = 1
    for h in H[1:]:
        if h >= m:
            cnt += 1
        m = max(m, h)
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int,input().split()))
count = 0
tmp2 = 0
for i in range(N):
  tmp = H.pop(0)
  if(i == 0):
    count += 1
    tmp2 = tmp
  else:
    if(tmp2 <= tmp):
      count += 1
      tmp2 = tmp
print(str(count))

Submission status: Accepted

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

ans = 1
max = h[0]

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

Submission status: Accepted

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

for i in range(N):
  flg = False
  for j in range(0, i):
    if H[j] <= H[i]:
      flg = True
    else:
      flg = False
      break
  if flg == True:
    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):
    if max(h[0:i]) <= h[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

maximum = 0
answer = 0
for Hi in H:
    if maximum <= Hi:
        answer += 1
    maximum = max(Hi, maximum)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
h=list(map(int, input().split()))
cnt=0
max_high=0

for i in range(N):
    if h[i]>=max_high:
        max_high=h[i]
        cnt+=1
        
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(readline())
  H = list(map(int, readline().split()))
  max_h = 0
  ans = 0
  for i in range(N):
    h = H[i]
    if max(h,max_h) == h:
      max_h = h
      ans += 1
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    M = [int(i) for i in input().split()]
    hm = 0
    count = 0
    for i in range(N):
        if hm <= M[i]:
            hm = M[i]
            count += 1
    print(count)
main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
sea = []
mountain = h[0]
for i in range(n):
    if i == 0:
        sea.append(h[0])
    else:
        if h[i] >= mountain and h[i] >= h[0]:
            mountain = h[i]
            sea.append(h[i])
        
print(len(sea))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
while len(H) < N:
    H.append(0)
see = 1
for i in range(1, N):
    tall = True
    for j in range(i):
        if(H[j] > H[i]):
            tall = False
            break
    if tall:
        see += 1
print(see)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
array1 = list(map(int,input().split()))
counter = 0
for i in range(n):
  j = 0
  while j <= i and array1[i] >= array1[j]:
    if i == j:
      counter += 1
    j += 1
print(counter)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
H = np.array(lr())
Hmax = np.maximum.accumulate(H)
answer = (H == Hmax).sum()
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#maior que todos os anteriores
k = int(input())
numerosStr = input().split()
numeros=[]
certo = True
contador=1
for q in numerosStr:
    numeros.append(int(q))

for i in range(1,len(numeros)):
    certo = True
    for j in range(i):
        if numeros[i] < numeros[j]:
            certo=False
            break
    if certo:
        contador+=1
print(contador)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input()) 
l = list(map(int, input().split()))
ans = 1
for i in range(1, n):
    if max(l[:i]) <= l[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

ans = 0
hight = 0

for i in range(len(H)):
    if hight <= H[i]:
        hight = H[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):
    l = h[:i]
    if h[i] >= max(l):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
H=[int(h) for h in input().split()]
top=H[0]
count=0
for t in H:
    if t>=top:
        count+=1
        top=t
    else:
        continue
print(count)

Submission status: Accepted

Solution code:
lista = []
contador = 0
entrou = 0
nVezes = int(input())
linha = input()
lista = linha.split()
for aux in range(len(lista)):
    for aux2 in range(aux,-1,-1):
        if int(lista[aux]) < int(lista[aux2]):
            entrou = 1
    if entrou == 0:
        contador += 1
    entrou = 0
print(contador)

Submission status: Accepted

Solution code:
n = int(input())
line = input()
lista = [int(n) for n in line.split()]
pos = 1
can = 0
for l in lista:
    semi_lista = lista.copy()
    semi_lista = semi_lista[0:pos]
    semi_lista.sort()
    step_max = semi_lista[len(semi_lista)-1]
    if l >= step_max:
        can+=1
    pos+=1
print(can)