Problem: 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?

Submission attempts (in order):
N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    min_index = min(max_indexs)

    return min_index + len(max_indexs)

  else:
    return max_indexs[0] + 1


S = check(H_li)
 
print(S)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    min_index = min(max_indexs)

    return min_index + len(max_indexs)

  else:
    return max_indexs[0] + 1


S = check(H_li)
 
print(S)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    min_index = min(max_indexs)

    return min_index + len(max_indexs)

  else:
    return max_indexs[0] + 1


S = check(H_li)
 
print(S)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    min_index = min(max_indexs)

    return min_index + len(max_indexs)

  else:
    return max_indexs[0] + 1


S = check(H_li)
 
print(S)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    return max_index
  else:
    return max_indexs[0]


max_index = check(H_li)

S = 0

for i in range(max_index):
  num = max_index - i
  try:
    if max(H_li[:num]) <= H_li[num]:
    	S += 1
  except:
    pass
    
print(S+1)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    return max_index
  else:
    return max_indexs[0]


max_index = check(H_li)

S = 0

for i in range(max_index):
  num = max_index - i
  try:
    if max(H_li[:num]) <= H_li[num]:
    	S += 1
  except:
    pass
    
print(S+1)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    return max_index
  else:
    return max_indexs[0]


max_index = check(H_li)

S = 0

for i in range(max_index):
  num = max_index - i
  try:
    if max(H_li[:num]) <= H_li[num]:
    	S += 1
  except:
    pass
    
print(S+1)


 

N = int(input())
H_li = list(map(int, input().split(' ')))

def check(H):
  H_max = max(H_li)
  max_indexs = ([i for i, x in enumerate(H_li) if x == H_max])

  if len(max_indexs) > 1:
    max_index = max(max_indexs)
    return max_index
  else:
    return max_indexs[0]


max_index = check(H_li)

S = 0

for i in range(max_index):
  num = max_index - i
  try:
    if max(H_li[:num]) <= H_li[num]:
    	S += 1
  except:
    pass
    
print(S+1)


 

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted

Accepted

Accepted

Accepted