Problem:


Score : 300 points

Problem Statement

Given is a permutation P_1, \ldots, P_N of 1, \ldots, N.
Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:  

For any integer j (1 \leq j \leq i), P_i \leq P_j.

Constraints

1 \leq N \leq 2 \times 10^5

P_1, \ldots, P_N is a permutation of 1, \ldots, N.  

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

i=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.

Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers i (1 \leq i \leq N) satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Time Limit Exceeded

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

count = 0

for i in range(n):
    for j in range(i):
        if p[i] > p[j]:
            break
    else:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
Pmin = [0] * N
for i in range(N):
    minP = 2 * 10**5
    for j in range(i+1):
        minP = min(minP, P[j])
    Pmin[i] = minP

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
Pmin = []
for i in range(N):
    Pmin.append(min(P[0:i+1]))

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

P = [int(x) for x in input().split()]

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

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n):
    ans = p[:i+1]
    if min(ans) != p[i]:
        count += 1
print(n-count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
import sys
pn = list(map(int, sys.stdin.readline().split()))

ans = 1

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

s = [0]*n

for i in range(1,n+1):
    a = min(p[:i])
    
    s[i-1] = a

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

Submission status: Time Limit Exceeded

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

count = 1
for i in range(1, N):
  Pi = sorted(P[:i+1])
  if Pi[0] >= P[i]:
    count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans_count=N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count-=1
print(ans_count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count[i]=False
print(ans_count.count(True))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(1,N):
    if(P[i]>=min(P[:i])):
        ans_count[i]=False
print(ans_count.count(True))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans_count=[True]*N
for i in range(N):
    for j in range(i):
        if(P[i]>=P[j]):
            ans_count[i]=False
print(ans_count.count(True))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [-1]
P += list(map(int, input().split(' ')))
count = 0
for i in range(1,N+1):
    boolean = True
    for j in range(1, i):
        if P[i] > P[j]:
            boolean = False
            break
    if boolean:
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
P=list(map(int,input().split()))
lst_con=[P[0]]
lst_num=[0]
s=0
for i in range(n):
  x=P[i]
  flag=True
  if x>lst_con[-1]:
    flag=False
  else:
    for j in range(lst_num[-1],i):
      if P[j]<x:
        flag=False
        break
  if flag:
    s+=1
print(s)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
P=list(map(int,input().split()))
s=0
for i in range(n):
  x=P[i]
  flag=True
  for j in range(i):
    if P[j]<x:
      flag=False
      break
  if flag:
    s+=1
print(s)

Submission status: Time Limit Exceeded

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

for i in range(n):
    for j in range(i+1):
        if p[i] > p[j]:
            cnt -= 1
            break
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
Count = 1
for T in range(1,N):
    if P[T]<min(P[:T]):
        Count += 1
print(Count)

Submission status: Time Limit Exceeded

Solution code:
#152
def main():
    N = int(input())
    P = list(map(int,input().split()))
    count = 1
    for i in range(1, N):
        p = P[:i]
        if(min(p)>=P[i]):
            count+=1
    print(count)
main()

Submission status: Time Limit Exceeded

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

Q=0
for i in range(N):
    if min(p[0:i+1])>=p[i]:
        Q+=1
print(Q)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
N=int(input())
P = list(map(int, input().split()))

count = 1

for i in range(N):
    for j in range(i):
        if P[j] < P[i]:
            break
        if j == i-1:
            count += 1

print(count)

Submission status: Time Limit Exceeded

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

for i in range(n):
  if P[i] == min(P[0:i+1]):
    ans += 1
  else:
    ans += 0
    
print(ans)

Submission status: Time Limit Exceeded

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

for i in range(n):
  if P[i] <= min(P[0:i+1]):
    ans += 1
  else:
    ans += 0
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 1
    for i in range(1, P[0]):
        if i == min(P[:P.index(i)+1]):
            ans += 1
    print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 1
    for i in range(1, P[0]):
        if i < min(P[:P.index(i)]):
            ans += 1
    print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        if min(P[:i+1]) == P[i]:
            ans += 1
    print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
c = 0
for j in range(n):
  if p[j] == min(p[:j+1]):
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
n = int(input())
p = list(map(int, input().split()))
c = 0
for j in range(n):
  if p[j] == min(p[:j+1]):
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(len(P)):
  if min(P[0:i+1]) == P[i]:
    ans += 1
  else:
    pass

print(ans)

Submission status: Time Limit Exceeded

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

# In[15]:


N = int(input())
P = list(map(int, input().split()))
print(sum([1 if x == min(P[:i+1]) else 0 for i,x in enumerate(P)]))


# In[ ]:

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
a = []
b = []
ans = 1
for i in range(1,len(P)):
    a = P[:i + 1]
    b= P[i]
    a.sort()
    if b == a[0]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
ans = 0
d = {}
m = {}
for i in range(n):
  d[i] = p[i]
  m[i] = min(p[:i + 1])
for i in range(n):
  if p[i] == m[i]:
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

m = []
for i in range(1,n+1):
    m.append(sorted(p[:i])[0])
    
ans = 0
for i in range(n):
    if m[i] == p[i]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(1, n+1):
    low = sorted(p[:i])
    if low[0] == p[i-1]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(1, n+1):
    low = p[:i]
    if min(low) == p[i-1]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

# 処理系
for i in range(n):
    if min(data[:i+1]) == data[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

max0, max1, count = [], 0, 0
for i in p:
    max0.append(i)
    max1 = i
    if max1 == 1:
        count += 1
        break
    elif min(max0) >= max1:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
#Cada numero é menor que todos seus antecessores
k = int(input())
numeros = [int(i) for i in input().split()]

certo = True
contador=1

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
Pn=[]
P=input().split()
for p in P:
    Pn.append(int(p))

count=1
nowmin=Pn[0]

for i in range(1,len (Pn)):
    targetArr=Pn[:i]
    if Pn[i]<nowmin:
        count+=1
        nowmin = Pn[i]
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in a:
  if b==[] or min(b)>=i:
    cnt+=1
    b.append(i)
  else:
    b.append(i)
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in a:
  if b==[] or min(b)>=i:
    cnt+=1
    b.append(i)
  else:
    b.append(i)

print(cnt)

Submission status: Time Limit Exceeded

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

count = 1
for i in range(1, n):
    if a[0] == 1:
        break
    elif a[i] <= min(a[:i]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

count = 1
for i in range(1, n):
    if a[i] <= min(a[:i]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P_list = [int(i) for i in input().split()]
c = 0
for j in range(N):
  if P_list[j] == min(P_list[0:j+1]):
    c += 1
  else:
    pass
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

result = 0
for i in range(N):
    flag = True
    for j in range(i,-1,-1):
        if P[i] > P[j]:
            flag = False
            break
    if flag:
        result += 1

print(result)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

result = 0
for i in range(N):
    flag = True
    for j in range(i,-1,-1):
        if P[i] > P[j]:
            flag = False
    if flag:
        result += 1

print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

answer = 0
for i in range(N):
    if min(Ps[:i + 1]) >= Ps[i]:
        answer = answer + 1

print(answer)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P = list(map(int,input().split()))
P = np.array(P)
ans = 0
for i in range(N):
  if P[i] == min(P[:i+1]):
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

a = []
ans = 0

for i in range(N):
  a.append(P[i])
  if min(a) >= P[i]:
    ans += 1
    
print(ans)

Submission status: Time Limit Exceeded

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

m = max(p)
cnt = 1
for i in range(1,n):
	if m > min(p[0:i]):
		m = min(p[0:i])
	if m >= p[i]:
		cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 1
for i in range(1,n):
	if min(p[0:i]) >= p[i]:
		cnt += 1
	#print(cnt,i)
	#print(p[0:i],p[i])
print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(n):
	for j in range(i+1):
		if p[j] < p[i]:
			cnt += 1
			break

print(n - cnt)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(N):
    Q = P[0 : i+1]
    if min(Q) == Q[-1]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    Q.append(P[i])
    if all([P[i] <= j for j in Q]):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    for j in P[0 : i]:
        if j < P[i]:
            break
    else:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(n):
  if(min(p[:i+1])==p[i]):
    cnt +=1
print(cnt)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(n):
  m = []
  for j in range(i+1):
    m.append(p[j])
  if min(m) == m[-1]:
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
c=0
N=int(input())
L=list(map(int,input().split()))
R=list()
for i in range(N):
  R.append(L[i])
  if min(R)==L[i]:
    c=c+1
print(c)

Submission status: Time Limit Exceeded

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

cnt = 1
for i in range(1,N):
	if P[i] < min(P[:i]):
		cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

total = 0
for i in range(n):
    tmp = lis[i]
    flag = 1
    for j in range(i):
        if tmp > lis[j]:
            flag = 0
            break
    if flag:
        total += 1
        
print(total)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        L = P[:n]
        L.sort()
        if P[n] <= L[0]:
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        L = P[:n]
        L = sorted(L)
        if P[n] <= min(L):
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        if P[n] <= min(P[:n]):
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

print(cnt)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(1, len(P)+1):
    M = P[:i]
    M.sort()
    if P[i-1] == M[0]:
        ans = ans +1

print(ans)

Submission status: Time Limit Exceeded

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

a=[]

ans = 0

for i in P:
  a.append(i)
  if min(a) >= i:
    ans+=1
    
print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(1, len(P)+1):
    M = min(P[:i])
    if P[i-1] == M:
        ans = ans +1

print(ans)

Submission status: Time Limit Exceeded

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

lis = list()

for i in range(1, len(P)+1):
    for j in range(1, i+1):
        if P[i-1] <= P[j-1]:
            pass
        else:
            lis.append(P[i-1])

lis

print(N - int(len(set(lis))))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
for i in range(n):
    if min(p[:i+1]) == p[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
for i in range(n):
    for j in range(i):
        if p[i] > p[j]:
            break
    else:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

for i in range(n):
    D=min(A[j] for j in range(i+1))
    ans.append(D)
    
print(len(set(ans)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A=list(map(int,input().split()))
cnt=0
for i in range(n):
    D=min(A[j] for j in range(i+1))
    #print(D)
    if A[i]<=D:
        cnt+=1
    else:
        pass
print(cnt)

Submission status: Time Limit Exceeded

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

for i in range(1,n):
	if p[i] <= min(p[:i]):
		a+=1
	else:
		pass
print(a+1)

Submission status: Time Limit Exceeded

Solution code:
n1 = int(input())

n2 = [int(i) for i in input().split()]

r1 = 0

for i1 in range(n1):
    if i1 == 0:
        r1 += 1 
        continue
    t1 = n2[0: i1]
    t1.sort()
    if t1[0] > n2[i1]:
        r1 += 1

print(r1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

judge = [1]*N
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      judge[i] = 0
      break
print(judge.count(1))

Submission status: Time Limit Exceeded

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

judge = [1]*N
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      judge[i] = 0
print(judge.count(1))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
ans = n
for i in range(1,n):
    if i> n- p[i]:
        ans -=1
    else:
        for j in range(i+1):
            r = True
            if p[i]>p[j]:
                ans -=1
                break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()
P = inlist()
c = 0
for i in range(n):
    f = True
    for j in range(i):
        if P[j] < P[i]:
            f = False
            break
    if f:
        c += 1
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 1
d = [1] + [0]*(n-1)
for i in range(1,n):
  if (p[i] <= p[i-1] and d[i-1] == 1):
    ans += 1
    d[i] = 1
  elif (d[i-1] ==0 and min(sorted(p[:i+1])) == p[:i+1][-1]):
    ans += 1
    d[i] = 1
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 1
 
for i in range(1,n):
  if min(sorted(p[:i+1])) == p[:i+1][-1]:
    ans += 1
    
print(ans)

Submission status: Time Limit Exceeded

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

for i in range(n):
  count = 0
  for j in range(i+1):
    if p[i] <= p[j]:
      count += 1
  if count == i+1:
    ans += 1
    
print(ans)

Submission status: Time Limit Exceeded

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

count = 1
for i in range(1, N):
    if P[i] <= min(P[:i]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
pre = True
ans = 1
for i in range(1,n):
  if pre and p[i]<=p[i-1]:
    ans += 1
  elif not pre and p[i]>p[i-1]:
    pre = False
  else:
    if min(p[:i])>=p[i]:
      ans += 1
      pre = True
    else:
      pre = False
print(ans)

Submission status: Time Limit Exceeded

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

count = 0

for j in range(N):
    target = P_list[j]
    if min(P_list[:j+1]) >= target:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
b=list(map(int,input().split()))
count=1
temp=[b[0]]
for i in range(1,n):
  temp.append(b[i])
  if b[i]==min(temp):
    count=count+1  
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
L=list()
ans=0
for n in A:
  L.append(n)
  if n==min(L):
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

def Min(i,L):
  if i == 0:
    return L[0]
  else:
    return min(Min(i-1,L), L[i])

count = 1
for i in range(1,N):
  if L[i]<=Min(i-1,L):
    count+=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
count = 0
tmp = p[0]

for i in range(len(p)):
    target = p[i]
    flag = True
    if tmp < target:
        tmp = target
        continue
    for j in range(i):
        if p[i] > p[j]:
            flag = False
            break
    if flag:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(len(p)):
    target = p[i]
    flag = True
    for j in range(i):
        if p[i] > p[j]:
            flag = False
            break
    if flag:
        count += 1
        
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(n):
    q = p[0:i+1]
    if min(q) == p[i]:
        c += 1

print(c)

Submission status: Time Limit Exceeded

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