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 = 0
for i in range(n):
    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 = 0
ans = 0
sum_h = 0

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+1)

Submission status: Accepted

Solution code:
N = int(input())
hotel = list(map(int,input().split()))
new =[]

count = 0
for i in hotel:
  new.append(i)
  if i == max(new):
    count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
Hlist = list(map(int, input().split()))
count=0
maxHi=1
for i in range(N):
    if Hlist[0] >= maxHi:
        count+=1
        maxHi=Hlist.pop(0)
    else:
        del Hlist[0]
print(count)

Submission status: Accepted

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

maxmount = 0
count = 0
for i in H:
    if maxmount <= i:
        maxmount = i
        count += 1

print(count)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    a = list(map(int,input().split()))

    ans = 0
    m = 0
    for i in a:
        if m <= i:
            ans += 1
        m = max(m,i)

    print(ans)








main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input().split()[0])
h_list = list(map(int, input().split()))
c = 1

for i, h in enumerate(h_list[1:]):
    pre_max = max(h_list[:i+1])
    if pre_max <= h:
        c += 1

print(c)

Submission status: Accepted

Solution code:
n = int(input())
height_list = [int(i) for i in input().split(" ")]
c = 0

for i, height in enumerate(height_list):
    if i == 0:
        c += 1
    else:
        if height >= max(height_list[:i]):
            c += 1
print(c)

Submission status: Accepted

Solution code:
#ABC 124, B - great ocean view
n = int(input())
H = [int(el) for el in input().split(' ')]

count = 1
max_h = H[0]
for i in range(1, n):
    if H[i] - max_h >= 0:
        count += 1
        max_h = H[i]

print(count)

Submission status: Accepted

Solution code:

n = int(input())
hs = map(int, input().split())

res = 0
mx = 0
for h in hs:
    if h >= mx:
        res += 1
    mx = max(h, mx)
print(res)

Submission status: Accepted

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

count=1
l=H[0]
for i in range(N-1):
  if H[i+1]-l>=0:
    count +=1
    l=H[i+1]
print(count)

Submission status: Accepted

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

ans = 0
max_H = 0
for H in H_arr:
    if H >= max_H:
        ans += 1
    max_H = max(max_H, H)

print(ans)

Submission status: Accepted

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

cnt = 1
for i in range(1, N):
  see = True
  for j in range(0, i):
    if H[j] > H[i]:
      see = False
  if see:
    cnt += 1
    
print(cnt)

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()))
cnt = 1

for i in range(1, n):
    flg = True
    for j in range(i):
        if h[i] < h[j]:
            flg = False
            break
    if flg==True:
        cnt += 1
print(cnt)

Submission status: Accepted

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

ans = []
for i in range(1,N):
    count = 0
    for j in range(i):
        if H[i] >= H[j]:
            count += 1
    if count == i:
        ans.append(i)
print(len(ans)+1)

Submission status: Accepted

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

no_ocean = 0

for i in range(n):
  for k in range(i+1):
    if height[k] > height[i]:
      	no_ocean += 1
      	break
    else:
        continue
        
print(n - no_ocean)

Submission status: Accepted

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

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

M = [0] * N
M[0] = 0

for i in range(1, N) :
    M[i] = max(M[i-1], H[i-1])
    
ret = 0
for i in range(N) :
    if H[i] >= M[i] :
        ret += 1
        
print(ret)

Submission status: Accepted

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

ans = 1
for i in range(1, N):
    flg = True
    for j in range(i):
        if H[j] > H[i]:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
max1 = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    c=1
    for i in range(1,n):
        if a[i] is max(a[:i+1]):
            c+=1
    print(c)

Submission status: Accepted

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

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

print(counter)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=[int(x) for x in input().split()]
ans=0
for i in range(n):
  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()))
sh = []
max_h = 0
for i in range(0,n):
    max_h = max(h[i],max_h)
    sh.append(max_h)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 1
for i in range(1, N):
    for j in range(0, i):
        if Hs[j] > Hs[i]:
            break
    else:
        c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())

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

mountain = int(1)
for i in range(1, n):
    for j in range(i):
        if int(L[j]) > int(L[i]):
            break
        if int(L[j]) <= int(L[i]) and j == i-1:
            mountain += 1
            break
        if int(L[j]) <= int(L[i]):
            continue

print(mountain)

Submission status: Accepted

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

cnt = 1

temp = H[0]

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N=int(input())
H=list(map(int,input().split()))
hightest=H[0]
count=1
for i in range(1,N):
    if H[i]>=hightest:
        hightest=H[i]
        count=count+1
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    H = [i for i in map(int, input().split())]

    ans = 0
    highest = H[0]
    for h in H:
        if highest <= h:
            ans += 1
            highest = h

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

N = i_inpl()
H = l_inpl()

ans = 0
max_val = -INF
for Hi in H:
    if Hi >= max_val:
        ans += 1
    max_val = max(max_val, Hi)
print(ans)

Submission status: Accepted

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

view = 0

max_height = 0
for i in H:
    if i >= max_height:
        view += 1
        max_height = i


print(view)

Submission status: Accepted

Solution code:
n = int(input())
h_array = [int(x) for x in input().split()]
cnt = 0
highest = h_array[0]
for index, h in enumerate(h_array, 1):
    if highest <= h:
        cnt += 1
        highest = h
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

num = 0
max = 0

for i in h:
    if i >= max:
        num += 1
        max = i

print(num)

Submission status: Accepted

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

count = 0
max_high = 0
for i in li:
    if max_high <= i:
        count += 1
        max_high = i

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 max <= h[i] :
        ans += 1
        max = h[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

lines = stdin.readlines()

H = [int(i) for i in lines[1].split()]

hight = 0
ans = 0

for h in H:
    if hight <= h:
        hight = h
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
def main():

    """ convenient functions
    # for i, a in enumerate(iterable)
    # q, mod = divmod(a, b)
    # divmod(x, y) returns the tuple (x//y, x%y)
    # Higher-order function: reduce(operator.mul, xyz_count, 1)
    # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
    """

    """convenient decorator
    # @functools.lru_cache():
    # to facilitate use of recursive function
        # ex:
        # from functools import lru_cache
        # import sys
        # sys.setrecursionlimit(10**9)
        # @lru_cache(maxsize=None)
        # def fib(n):
        #     if n < 2:
        #         return n
        #     return fib(n-1) + fib(n-2)
        # print(fib(1000))
    """
    
    # import numpy as np
    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
    # accumulate() returns iterator! to get list: list(accumulate())
    from math import factorial, ceil, floor, sqrt
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  # prime factor
        b, e = 2, 0  # base, exponent
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        # TODO: How should I do when n - r is negative?
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
    from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
    import operator
    from operator import itemgetter
    # ex1: List.sort(key=itemgetter(1))
    # ex2: sorted(tuples, key=itemgetter(1,2))
    from functools import reduce, lru_cache
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    # first create factorial_list
    # fac_list = mod_factorial_list(n)
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
    def modinv(a, p = MOD):
        # evaluate reciprocal using Fermat's little theorem:
        # a**(p-1) is identical to 1 (mod p) when a and p is coprime
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        # fac_list = modfactorial_list(100)
        # print(modcomb(100, 5, modfactorial_list(100)))
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    """ initialize variables and set inputs
    # initialize variables
        # to initialize list, use [0] * n
        # to initialize two dimentional array, use [[0] * N for _ in range(N)]
    # set inputs
        # open(0).read() is a convenient method:
        # ex) n, m, *x = map(int, open(0).read().split())
        #     min(x[::2]) - max(x[1::2])
        # ex2) *x, = map(int, open(0).read().split())
        #     don't forget to add comma after *x if only one variable is used
    # preprocessing
        # transpose = [x for x in zip(*data)]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
        # flat = [flatten for inner in data for flatten in inner]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
    # calculate and output
        # output pattern
        # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
    """

    # functions used
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rmap = lambda: map(int, r().split())
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))

    """ how to treat input
    # single int: int(r())
    # single string: r()
    # single float: float(r())
    # line int: R()
    # line string: r().split()
    # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
    # lines int: [R() for _ in range(n)]
    """

    if __name__ != '__main__':
        # for test
        sys.stdin = open('sample.txt')

    # ----------------------------------
    # main

    N = int(r())
    H = R()
    tmp, cnt = 0, 0
    for i in H:
        if i >= tmp:
            cnt += 1
            tmp = i
    print(cnt)
    
    # end of main
    # ----------------------------------

    """memo: how to use defaultdict of list
    # initialize
    Dic = defaultdict(list)
    # append / extend
    Dic[x].append(y)
    # for
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    H = string_to_int(inputs[0])

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


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
num = int(input())
arr = list(map(int, input().split()))

count=0

now_max = arr[0]

for v in arr:
    if v>=now_max:
        count += 1
        now_max = v

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
    else:
        ans += 1
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 range(i):
        if H[i] < H[j]:
            break
    else:
        ans += 1

print(ans)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    H = [int(s) for s in input().split() if s]
    max_height = 1
    count = 0
    for h in H:
        if h >= max_height:
            count += 1
            max_height = h
    print(count)
    
solve()

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 1

high = h[0]

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


print(ans)

Submission status: Accepted

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

tmp = v[0]
ans = 1
for i in range(1,n):
        if v[i] >= tmp:
            ans+=1
            tmp = v[i]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int,input().split()))
score = 1
h = lst[0]
for p in range(n-1):
	if lst[p+1] >= h:
		score += 1
		h = lst[p+1]
	else:
		pass
print(score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
x = [int(n) for n in input().split()]
count = 1
height = x[0]
for s in range(num - 1):
    if height <= x[s+1]:
        count += 1
        height = x[s+1]
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
h=[int(i) for i in input().split()]
ans=0
for i in range(n):
    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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,N):
  if max(H[:i+1])==H[i]:
    z+=1

print(z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
heights = list(map(int, input().split()))
result = []
max_height = 0
for height in heights:
  if max_height <= height:
    result.append(1)
    max_height = height
print(sum(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3
#sys.setrecursionlimit(int(1e+6))
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
MOD = int(1e+9) + 7

def main():
    N = i2n()
    H = i2nn()
    n = 1
    h = H[0]
    for i in range(1, N):
        if H[i] >= h:
            h = H[i]
            n += 1
    print(n)

main()

Submission status: Accepted

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

for i in range(1,len(h)):
    flag = 0
    for j in range(i):
        if h[i]<h[j]:
            flag = 1
            break
    if flag == 0:
        ans = ans+1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#r, d, x = map(int,input().split())
n = int(input())
h = list(map(int,input().split()))
#s = input()

ans = 0
for i in range(len(h)):
  if h[i] == max(h[:i+1]):
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

print(ans)

Submission status: Accepted

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

cnt = 1

for i in range(n-1):
    cnt_min = 0
    for j in range(i+1):
        if h[i+1] >= h[j]:
            cnt_min += 1
    if cnt_min == i+1:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ary = list(map(int, input().split()))
count = 1
for i in range(1, n):
    flag = True
    pointed_mountain = ary[i]
    for another_mountain in ary[:i]:
        if another_mountain > pointed_mountain:
            flag = False
            break
    if flag:
        count += 1

print(count)

Submission status: Accepted

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