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()))
a=0
i=0

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

Submission status: Time Limit Exceeded

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

for i in range(N):
  if all(p[i]<=p[j] for j in range(i+1)):
    a+=1
print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
pn = list(map(int, input().split()))
count = 1

for i in range(1,len(pn)):
    if min(pn[:i]) > pn[i]: count += 1
print(count)

Submission status: Time Limit Exceeded

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

for i in range(0, len(pn)):
    icount = 0
    for j in range(0, i):
        if pn[i] <= pn[j]:
            icount += 1
    if icount == i:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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


ans=0
for k,v in enumerate(a):
#    print("vvvvvvvvv",v)
    f=0
    for i in range(k,-1,-1):
        if a[i]<v:
            f=1
            break
#        print(a[i],end=" ")
    if not f:
        ans+=1
#    print("aaaa",ans)
print(ans)

Submission status: Time Limit Exceeded

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

aa = list(reversed(A))

cnt = 0
for i in range(0,N):
    if aa[i] == min(aa[i:]):
        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):
    M=min(P[:i+1])
    if M==P[i]:
        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):
    flg=1
    for j in range(0,i+1):
        if P[j]<P[i]:
            flg=0
            break
    if flg:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

import numpy as np
Nums.reverse()
cnt =0
d= np.array(Nums)

for i in range(N):
    P_i = d[0]
    d= np.delete(d,0)
    if (d>=P_i).prod() ==1:
        cnt +=1
    elif (d>=P_i).size ==0:
        cnt +=1

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(1, N + 1):
  target = P[:i]
  if target[-1] == min(target):
    cnt += 1
  
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
p_min = p[0]
p_sum = 1

for i in range(n):
    # リストを前から順にスライス
    p_new = p[0:i+1]
    
    # スライスしたリストの中の最小値を取得
    p_new_min = min(p_new)

    # 今までの最小値と比較して小さい場合
    if p_new_min < p_min:
        p_sum += 1
        # 最小値の更新
        p_min = p_new_min

print(p_sum)

Submission status: Time Limit Exceeded

Solution code:
#https://atcoder.jp/contests/abc152/tasks/abc152_c

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3

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

for i in range(0, N):
    P_i = P[i]
    P_j = P[0:i+1]
    if P_i == min(P_j):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3

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

for i in range(0, N):
    if all(P[i] <= P[j] for j in range(0, i+1)):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def main():
  N=int(input())
  P=list(map(int,input().split()))
  sumCount=1
  for i in range(1,N):
    if(P[i]<=min(P[0:i+1])):
      sumCount=sumCount+1
  print(sumCount)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
def main():
  N=int(input())
  P=list(map(int,input().split()))
  sFlag=True
  i=0
  sumCount=0
  for i in range(N):
    Pi=P[i]
    Pj=min(P[0:i+1])
    if(Pi<=Pj):
      sumCount=sumCount+1
  print(sumCount)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
def main():
  N=int(input())
  P=list(map(int,input().split()))
  sFlag=True
  i=0
  sumCount=0
  for i in range(N):
    Pi=P[i]
    for j in range(0,i+1):
      Pj=P[j]
      if(Pi>Pj):
        break
      if(j==i):
        sumCount=sumCount+1
  print(sumCount)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
def main():
  N=int(input())
  P=list(map(int,input().split()))
  sFlag=True
  i=0
  sumCount=0
  while(sFlag):
    Pi=P[i]
    for j in range(0,i+1):
      Pj=P[j]
      if(Pi>Pj):
        break
      if(j==i):
        sumCount=sumCount+1
    i=i+1
    if(i==N):
      sFlag=False
  print(sumCount)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
sFlag=True
i=0
sumCount=0
while(sFlag):
  Pi=P[i]
  for j in range(0,i+1):
    Pj=P[j]
    if(Pi>Pj):
      break
    if(j==i):
      sumCount=sumCount+1
  i=i+1
  if(i==N):
    sFlag=False
print(sumCount)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import heapq
n = int(input())
p = list(map(int, input().split()))
plist = []
for i in range(n):
  plist.append(p[:i + 1])
count = 0
for j in range(n):
  heapq.heapify(plist[j])
  mina = heapq.heappop(plist[j])
  if mina >= p[j]:
    count += 1
print(count)

Submission status: Time Limit Exceeded

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

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[1] <= P[0]):
        P.pop(0)
        count += 1
    else:
        P.pop(1)


print(count)

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[1] <= P[0]):
        P.pop(0)
        count += 1
    else:
        P.pop(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(n):
	val=i+1
	l=[]
	for j in range(val):
		l.append(p[j])
	if min(l)==p[j]:
		count+=1
print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
#152 Low Elements
n = int(input())
seq = list(map(int,input().split()))
num = 0
for i in range(1,n+1):
    test = seq[:i]
    if min(test) == seq[i-1]:
        num += 1
print(num)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_ls = list(map(int, input().split()))
sum_=0
for i in range(0,n):
  j=0
  if i==0: max_,min_=p_ls[i],p_ls[i]
  #print('%d %d'%(i,j))
  #print(max_)
  while j<=i:
    if min_>p_ls[i]: 
      min_=p_ls[i]
      break
    elif max_<p_ls[i]:
      max_=p_ls[i]
      sum_-=1
      break
    elif p_ls[j]<p_ls[i]:
      sum_-=1
      break
    j+=1
  sum_+=1
print(sum_)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_ls = list(map(int, input().split()))
sum_=1
for i in range(1,n):
  j=0
  #print('%d %d'%(i,j))
  while j<=i:
    if p_ls[j]<p_ls[i]:
      sum_-=1
      break
    j+=1
  sum_+=1
print(sum_)

Submission status: Time Limit Exceeded

Solution code:
l = int(input())
ll = list(map(int,input().split()))

count = 0

for a in range(l):
  lll = ll[0:a]
  if all([i > ll[a] for i in lll])==False:
    pass
  else:
    count+=1

print(count)

Submission status: Time Limit Exceeded

Solution code:
l = int(input())
ll = list(map(int,input().split()))

count = 0

for a in range(l):
  lll = ll[0:a]
  if all([i > ll[a] for i in lll])==True:
    count+=1

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0;

for i in range(len(A)):
  if min(A[:i+1]) == A[i]:
    ans += 1;
  else:
    pass;
  
print(ans);

Submission status: Time Limit Exceeded

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

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

print(total)

Submission status: Time Limit Exceeded

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

total = 0
for i in range(n):
    for j in range(i,-1,-1):
        if data[i] > data[j]:
            break
    else:
        total += 1

print(total)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n=int(input())
p=list(map(int,input().split()))
cnt=0
s=deque()
for i in p:
  s.append(i)
  if min(s)==i:
    cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

ans=0
for i in range(n):
    if p_inputs[i]<=min(p_inputs[: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()))
c = 0
for i in range(1,n+1):
  if p[i-1] == min(p[:i]):
    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(1,n+1):
  if p[i-1] == min(p[:i]):
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
for i in range(len(P)):
  m = P[i]
  subm = min(P[:i+1])
  if m == subm:
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
for i in range(len(P)):
  m = P[i]
  subm = min(P[:i+1])
  if m == subm:
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
def number(m,l):
  count=0
  for i in range(m):
    if min(l[:i+1])==l[i]:
      count+=1
  return count

n=int(input())
p=list(map(int,input().split()))
result=number(n,p)
print(result)

Submission status: Time Limit Exceeded

Solution code:
def number(m,l):
  count=0
  for i in range(m):
    if min(sorted(l[:i+1]))==l[i]:
      count+=1
  return count

n=int(input())
p=list(map(int,input().split()))
result=number(n,p)
print(result)

Submission status: Time Limit Exceeded

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

p = [0]+p

ansList =[]
for i in range(1,n+1):
  if min(p[1:i+1])==p[i]:
    ansList.append(p[i])
    
print(len(ansList))

Submission status: Time Limit Exceeded

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

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

print(count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    new_arr = arr[0:i+1]
    if min(new_arr) >= arr[i]:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    flg = True
    for j in range(0,i,1):
        if arr[j] < arr[i]:
            flg = False
            break

    if flg:
        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(N):
    if min(P[:i+1]) == P[i]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
count = 0

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

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
count = 0

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

q = []

for i in range(n):
    q.append(p[i])
    if q[i] == min(q):
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

P = FLI()

cnt = 0
for i in range(n):
    chk = True
    for j in range(0, i)[::-1]:
        if P[i] > P[j]:
            chk = False
    if chk:
        cnt += 1
        
print(cnt)

Submission status: Time Limit Exceeded

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

    
if __name__ == '__main__':
    q3()

Submission status: Time Limit Exceeded

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


if __name__ == '__main__':
    q3()

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    count = 0
    tmp = A[i]
    for j in range(i+1):
        if tmp <= A[j]:
            count += 1
        else:
            break

    if count == i+1:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

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

    if count == i+1:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    count = 0
    for j in range(i+1):
        if A[i] <= A[j]:
            count += 1

    if count == i+1:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
l = []
for i in range(n):
    l.append(min(p[:i + 1]))
print(len(set(l)))

Submission status: Time Limit Exceeded

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

ans=0
for i in range(N):
    if min(jun[:i+1]) == jun[i]:
        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(1, N+1):
  if A[i-1] == 1:
    count += N - i
    break
  else:
    for j in range(1, i+1):
      if A[j-1] < A[i-1]:
        count += 1
        break

ans = N - count
print(ans)

Submission status: Time Limit Exceeded

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

c = 0
s = 0

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
count = 0

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

ans = N - count
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def myAnswer(N:int,P:list) -> int:
   total = 0
   for i in range(N):
      if(min(P[:i+1])>= P[i]):
         total+=1
   return total

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))

if __name__ == '__main__':
   main()

Submission status: Time Limit Exceeded

Solution code:
def myAnswer(N:int,P:list) -> int:
   total = 0
   for i in range(N):
      for j in range(0,i):
         if(P[j]< P[i]):
            break
      else:
         total += 1
   return total

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))

if __name__ == '__main__':
   main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

l = []
m = [P[0]]
for i in range(N):
    if P[i] <= min(m):
        m.append(P[i])
        continue
    else:
        l.append(i)
print(N - len(l))

Submission status: Time Limit Exceeded

Solution code:
input()
lst=[]
s=0
for i in map(int,input().split()):
    lst.append(i)
    if min(lst)==i:
        s+=1
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

l = []
for i in range(N):
    for j in range(i + 1):
        if P[i] <= P[j]:
            continue
        else:
            l.append(i)
            break
print(N - len(l))

Submission status: Time Limit Exceeded

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

for i in range(n):
    ans += 1
    for j in range(i):
        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()))
count=1
for i in range(1,n):
  if min(p[i],min(p[:i])) == p[i]:
    count+=1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
num=[]
a=input().split(" ")
ans=[]
con=[]
for i in range(n):
    num.append(int(a[i]))
for i in range(n):
    count=0
    con.append(int(num[i]))
    if i==0:
        ans.append(num[i])
    else:
        if num[i]==min(con):
            ans.append(num[i])

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
num=[]
a=input().split(" ")
ans=[]
for i in range(n):
    num.append(int(a[i]))
for i in range(n):
    count=0
    if i==0:
        ans.append(a[i])
    else:
        for j in range(0,i):
            if num[i]>num[j]:
                count+=1
        if count==0:
            ans.append(a[i])

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    c=1
    for i in range(1,N):
        if P[i]<min(P[:i]):
            c+=1
    print(c)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
p_min = []
for ind in range(1,n+1):
    p_min.append(min(p[:ind]))
# print(p_min)
cnt = 0
for ind in range(n):
    if p[ind] <= p_min[ind]:
        cnt += 1  
print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=[int(_) for _ in input().split()]
    count=0
    for i in range(n):
        if min(P[:i+1])==P[i]:count+=1
    print(count)

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
l = []
for i in range(n):
    l.append(min(p[:i+1]))
print(len(list(set(l))))

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=1
for i in range(1,n):
    if min(p[:i])>=p[i]:
        a+=1
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
k = []
ans = 0
k = []
for i in range(0,N):
  #P_i <= P_jの判定
  #これまでで最小値だったら、+1
  k.append(P[i])
  k.sort()
  if k[0] == P[i]:
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


N=input1()
p=input_array()
count=0
for i in range(N):
	flag=True
	for j in range(len(p[:i+1])):
		if p[i]<=p[j]:
			flag=True
		else:
			flag=False
			break
	if flag:
		count+=1
print(count)

Submission status: Time Limit Exceeded

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

cnt = 0
tmp = []
for i in range(len(lst)):
    num = lst[i]
    tmp.append(num)
    if num == min(tmp):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(len(lst)):
    num = lst[i]
    if num == min(lst[:i+1]):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(len(lst)):
    num = lst[i]
    if num == min(sorted(lst[:i+1])):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(len(lst)):
    num = lst[i]
    r_lst = sorted(lst[:i+1])

    if num == r_lst[0]:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(len(lst)):
    num = lst[i]
    bl = True
    for j in lst[:i]:
        if num > j:
            bl = False
            break

    if bl:
        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):
    if P[i] <= min(P[:(i+1)]):
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
num = list(map(int, input().split()))
l = []
l.append(num[0])
count = 1

for i in range(1,n):
  if num[i]<=min(a for a in l):
    count += 1
    l.append(num[i])
  else:
    l.append(num[i])

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
num = list(map(int, input().split()))
list = []
list.append(num[0])
count = 1

for i in range(1,n):
  if num[i]<=min(a for a in list):
    count += 1
    list.append(num[i])
  else:
    list.append(num[i])

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):
    if all([P[i] <= p for p in P[:i+1]]):
        c += 1
    #if P[i] >= P[i + 1]:
     #   c += 1
print(c)

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):
    if min(P[:i]) >= P[i]:
        cnt+=1
#         print(i, cnt)
        
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):
    s = min(p[:i+1])
    if p[i] <= s:
        ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#C
N = int(input())
Pi = input().split(' ')
ans = [Pi[0]]
for k in range(N):
    count = 0
    for s in range(k):
        if int(Pi[k]) <= int(Pi[s]):
            count += 1
        if count == k:
            ans.append(k)
        else:
            pass
print(len(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    N=int(input())
    str=list(map(int,input().split()))
    ct=0
    for i in range(N):
        for j in range(i+1):
            if str[i]>str[j]:
                break
            elif j==i:
                ct+=1
    print(ct)

main()

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    lists_slice = lists[:i+1]
    lists_min = min(lists_slice)
    if lists_min >= lists[i]:
        count+=1

    # cnt = 0
    # for j in lists_slice:
    #     if lists_slice[i] <= j:
    #         cnt += 1
    # if cnt == i+1:
    #     count+= 1
print(count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    lists_slice = lists[:i+1]
    cnt = 0
    for j in lists_slice:
        if lists_slice[i] <= j:
            cnt += 1
    if cnt == i+1:
        count+= 1
print(count)