Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Created July 21, 2017 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/10da5eaabcb42bb3216c6cac68776a79 to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/10da5eaabcb42bb3216c6cac68776a79 to your computer and use it in GitHub Desktop.
N = int(input())
A = [int(x) for x in input().split()]
t = 0
ans = 0
for i in range(N):
if i == 0 or A[i-1] < A[i]:
t += 1
else:
ans += t*(t+1)//2
t = 1
ans += t*(t+1)//2
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment