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())
plist = list(map(int,input().split()))

islow = True
counter = 0

for i in range(len(plist)):
    islow = True
    if i != 0 and plist[i] < plist[i-1]:
        for j in range(plist.index(plist[i])):
            if plist[i] <= plist[j]:
                pass
            else:
                islow = False
                break
        if islow:
            counter += 1
    elif i == 0:
        counter += 1


print(counter)

Submission status: Time Limit Exceeded

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

for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > p[i-1]:
        miss += 1
        continue

    #if p[i] > max(s):
    #    miss += 1
    #    continue
 
    s = sorted(s,reverse=True)
    for j in range(i):
        if p[i] > s[j]:
            miss += 1
            break

print(n-miss)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = input()
p = input().split()

i_cnt = 1
for j in range(len(p)):
  for i in range(j):
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Submission status: Time Limit Exceeded

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

counter = 1
for i in range(1,n):
    for x in P[0:i]:
        if P[i]>x:
            break
    else:
        counter +=1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
loop = int(input())
num_list = list(map(int, input().split()))
ans = 0
for idx, n in enumerate(num_list):
  flg = True
  if idx > 0:
    for m in num_list[: idx]:
      if m < n:
        flg = False
        break
  if flg:
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

class Node:
    def __init__(self, data): #コンストラクタ
        self.data = data #ノードがもつ数値
        self.left = None #左エッジ
        self.right = None #右エッジ


class BST:
    def __init__(self, number_list): #コンストラクタ
        self.root = None #ルートノード初期化
        for node in number_list: #数値を持つ配列から二分木を生成
            self.insert(node) #挿入メソッドを使ってノードを挿入する
    #挿入
    def insert(self, data):
        n = self.root
        if n == None:
            self.root = Node(data)
            return
        else:
            while True:
                entry = n.data
                if data < entry:
                    if n.left is None:
                        n.left = Node(data)
                        return
                    n = n.left
                elif data > entry:
                    if n.right is None:
                        n.right = Node(data)
                        return
                    n = n.right
                else:
                    n.data = data
                    return
    def count(self, ans):
        n = self.root
        while True:
        		if n != None:
          			ans += 1
          			n = n.left
        return ans

tree = BST(p)
ans = tree.count(0)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
l=[p[0]]
for i in range(1,n):
	l.append(p[i])
	flag="True"
	for j in range(i):
		if flag=="True":
			if p[i]>p[j]:
				l.remove(p[i])
				flag="False"
print(len(l))

Submission status: Time Limit Exceeded

Solution code:
hoge = [input() for i in range(2)]
tmp = hoge[1].split()
num = int(hoge[0])

tmp = list(map(int,tmp))

flag = 1
count = 0
j = 1
for i in range(num):
    now_list = tmp[:j]
    if len(now_list) == len([None for piyo in now_list if piyo >= now_list[-1]]):
        count += 1

    j += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
cnt = 0
for index, i in enumerate(A):
    #print("index:{}".format(index))
    for j in range(index + 1):
        if i > A[j]:
            #print("break:{}".format(j))
            break
        elif index == j:
            ans += 1
            break
        #print("j:{}".format(j))




print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=list(map(int, input().split()))
# n=5
# l=[4,2,5,1,3]
count=0

import heapq


for i in range(1,len(l)+1):
    s=l[:i]
    heapq.heapify(s) 
    if heapq.heappop(s[:i])==l[i-1]:
        count+=1
    
    
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = input().split()
check_counter = 0
counter = 0
for i in range(N):
    k = i+1
    for j in range(k):
        if int(P[i]) <= int(P[j]):
            check_counter += 1
        else:
            break
    if (k == check_counter):
        counter += 1
    check_counter = 0
print(counter)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
PP=np.array(input().split(),dtype=np.int64)
count=1
if (N==1):
    print(count)
else:
    for i in range(1,N):
        P1=PP[0:i+1]
        MIN=np.min(P1)
        TAR=P1[i]
        if (MIN==TAR):
            count += 1

    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()
P_list = input().split()
# N = '5'
# P_list = '4 2 5 1 3'.split()
P_list = [int(i) for i in P_list]
length = len(P_list)
ans = length 
for i in range(length):
    for j  in range(i):
        if P_list[i] > P_list[j]:
            ans -= 1
            j= 0
            # print(P_list[i] , P_list[j],ans)
            break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
count = 0
s2 = set()
s2.add(P[0])
for i, p in enumerate(P):
    if p <= min(s2):
        count += 1
    s2.add(p)

print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1, len(p)):
    for j in reversed(range(i)):
        if p[j] < p[i]:
            flag = 1
            break
    if flag == 0:
        count += 1
        flag = 0
    else:
        flag = 0
        continue
print(count)

Submission status: Time Limit Exceeded

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

counter = 0
for i in range(len(lis)):
    counter += 1*(lis[i] <= min(lis[:i+1]))
print(counter )

Submission status: Time Limit Exceeded

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


result=0

for pp in p:
    flag=True
    buf=p[0:pp]
    for bb in buf:
        if bb < p[pp-1]:
            flag=False
            break
    if flag==True:
        result+=1
        
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

#print(N)
#print(P)

SUCCESS = N
pre_max = P[0]
for i in range(N):
    j = i - 1
    if pre_max < P[i]:
        #print(i, j, pre_max)
        pre_max = P[j]
        SUCCESS -= 1
        continue

    while j >= 0:        
        if P[i] > P[j]:
            #print("Fail", i,j)
            SUCCESS -= 1
            break        
        j -= 1

print(SUCCESS)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 1
ll = [min(l[:i+1]) for i in range(N)]
for i in range(1,N):
  if ll[i-1] > l[i]:
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

m = [10**6]
for j in range(1, n):
    m.append(min(p[:j]))

ans = 1
for i in range(1, n):
    if m[i] >= p[i]:
        ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

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

memo = [0] * N
memo[0] = 1
for i in range(1, N):
    if P[i] > P[i-1]:
        memo[i] = 0
    elif P[i] == P[i-1]:
        memo[i] = memo[i-1]
    else:
        if P[i] <= min(P[0:i]):
            memo[i] = 1
        else:
            memo[i] = 0
print(sum(memo))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

ans=0

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

print(ans)

Submission status: Time Limit Exceeded

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

    answer = 0

    for i in range(1, len(P_list)+1):
        #print("i:" + str(i))
        ok_flag = True
        for j in range(1, i+1):
            #print("j:" + str(j))
            #print(" P_list[i-1]:" + str(P_list[i-1]))
            #print(" P_list[j-1]:" + str(P_list[j-1]))
            if P_list[i-1] <= P_list[j-1]:
                ok_flag = True
            else:
                ok_flag = False
                break
        if ok_flag:
            answer += 1

    print(answer)

 
if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
an = [int(i) for i in input().split()]
lowe = 0
for i in range(0, n):
    an_sub = an[0:i + 1]
    if an_sub[i] <= min(an_sub):
        lowe += 1
print(lowe)

Submission status: Time Limit Exceeded

Solution code:
#C - Low Elements
x = int(input())
P = list(map(int, input().split()))
ans=0
while x >=1:
    P = P[0:x]
    m=min(P)
    x=P.index(m)
    ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
nn = [x for x in range(n)]
p = list(map(int,input().split()))
check = []
for i in nn:
    for j in range(0,i+1):
        if p[i] > p[j]:
            check.append(i)
            continue
print(n-len(set(check)))

Submission status: Time Limit Exceeded

Solution code:
N=input()
N=int(N)
P=input().split(" ")


buf=[]
count=0
for i in range(N):
  P_i=int(P[i])
  for j in range(i):
    if int(P[j])>=P_i:
      buf.append(i)
  if len(buf) == i:
    count=count+1
  buf=[]
print(count)

Submission status: Time Limit Exceeded

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

# print(N, l)
# Pi < Pj
result = []
r = False
for i in range(1, N+1):
    count = 0
    for j in range(0, i):
        if P[i - 1] <= P[j]:
            count += 1
    if count >= i:
        result.append(i)

print(len(set(result)))

Submission status: Time Limit Exceeded

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

for i in range(N):
  if sorted(list(P[0:i+1]))[0] == P[i]:
    ans += 1
    
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
h=list(map(int,input().split()))
c = 0
a = h[0]
for i in range(0,N):
    s = 0
    if h[i] > a:
        a = h[i]
    else:
        for j in range(0,i):
            if h[j] >= h[i]:
                s += 1
        if s == i:
            c += 1
print(c)

Submission status: Time Limit Exceeded

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

res = 0
aa = 0
for i in p:
    if res ==0:
        res += 1
        aa += 1
        continue
    if i <= min(p[0:aa]):
        res += 1
    aa += 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
l=len(p)
for i in range(n):
    if p[i]!=0:
        for j in range(i+1,n):
                try:
                    if p[i]<p[j]:
                        p[j]=0
                        continue
                except IndexError:
                    break
num=p.count(0)
print(l-num)

Submission status: Time Limit Exceeded

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

for i in range(n):
    ng=True
    for j in range(i):
        if p[i] > p[j]:
            ng=False
            break

    if ng:
        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):
    for j in range(i+1):
        if p[i] <= p[j]:
            if i == j:
                cnt += 1
        else:
            break
print(cnt)

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 P[i] <= min(P[0:i]):
        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):
  if all(list(map(lambda x: x >= P[i], P[:i]))):
  	count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

c = 1
if p_list == [p_list[0]]*N:
    print(len(p_list))

elif p_list == sorted(p_list):
    print(1)

elif p_list == sorted(p_list, reverse=True):
    print(len(p_list))

else:
    for i in range(N):
        temp = 0
        for j in range(i):
            if p_list[i] <= p_list[j]:
                temp += 1
                if temp == i:
                    c += 1
            else:
                break
    print(c)
    #print("else")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

N = map(int,input())
N_list = list(map(int,input().split()))
tmp = []
all_list = []
for i in range(len(N_list)):
    target = N_list[i]
    tmp.append(target)
    all_list.append(tmp.copy())
 
n = [min(b) for b in all_list]
print(len(set(n)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

counter = 1
for i in range(1,n):
    if [x for x in P[0:i] if P[i]>x ] == []:
        counter +=1

print(counter)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

cnt = 0
before_hairetsu = [N+1] * N

#i_before = N + 1
before_hairetsu[0] = N + 1
for i in range(N):
  if(min( min(before_hairetsu) , P[i]) >= P[i]):
    cnt += 1
  #i_before = P[i]
  before_hairetsu.append( P[i] )
  
print(cnt)

Submission status: Time Limit Exceeded

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

for i in range(n):
  for j in range(i):
    if p[j] >= p[i]:
      continue
    else:
      tof = False
      continue
  if tof:
    count += 1
  else:
    tof = True
  
print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1, N):
  for j in range(i+1):
    if P[i] > P[j]:
      break
    if i == j:
      c += 1

print(c)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=1


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


print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
c=list(map(int,input().split()))
count1=1
for i in range(1,n):
  t=max(c[:i])
  g=min(c[:i])
  if c[i]<=t and c[i]<=g:
    count1+=1
print(count1)

Submission status: Time Limit Exceeded

Solution code:
def check(target_num, num_list):
    count = len([ i for i in num_list if i < target_num])
    if count == 0:
        return 1
    else:
        return 0

def solve(n, p_list):

    count = 0
    for i in range(n):
        target_num = p_list.pop()
        count += check(target_num, p_list)
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import queue
import copy
import math
from collections import deque

# そのまま入力文字列の入力
n = int(input())

# 空白区切りの数値をリスト化
pn = list(map(int, input().split()))

ans = 0
for i in range(0, n):
    if i == 0:
        ans += 1
        continue

    all_small = True

    for j in range(i, -1, -1):
        if pn[i] <= pn[j]:
            continue
        else:
            all_small = False
            break

    if all_small:
        ans += 1


print(ans)

Submission status: Time Limit Exceeded

Solution code:
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0
 
n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_list = list(map(int, input().split()))
i_count = 0
for i in range(len(p_list)):
    pi = p_list[i]
    pass_count = 0
    for j in range(i + 1):
        pj = p_list[j]
        if pi <= pj:
            pass_count += 1
    if i + 1 == pass_count:
        i_count += 1
print(i_count)

Submission status: Time Limit Exceeded

Solution code:
import bisect

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

    ans = 0
    first = P[0]-1
    i = N
    while i != 0:
        ans += 1
        m = min(P[0:i])
        i = P.index(m)

    print(ans)

    return 0

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
P = np.array(input().split(' '), dtype = int)

counta = 0
for i in range(N):
    counta += np.any((P[:i+1] < P[i]))
print(N - counta)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
c=0
l=[int(i) for i in input().split()]
for i in range(n):
  c1=0
  for j in range(i+1):
    if(l[j]<l[i] and c1!=1):
      c+=1
      c1=1
print(n-c)

Submission status: Time Limit Exceeded

Solution code:
input_list=[input() for i in range(2)]
N = int(input_list[0])
P_s = list(map(int,input_list[1].split()))	
output_s = 0
for i in range(N):
    output_num = 0
    for j in range(i+1):
        if P_s[i] > P_s[j]:
            output_num += 1
            break
    if output_num == 0:
        output_s += 1

print(output_s)

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+1]) == P[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(N):
    if i == 0:
        ans += 1
        continue

    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

i = 0
while i < N:
    j = 0
    while j <= i:
        if i == j:
            ans += 1
            break
        if p[j] < p[i]:
            break
        j += 1
    i += 1

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(N):
  for j in range(i+1):
    if P[i] > P[j]:
      break
    if i == j:
      c += 1

print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > max(s):
        miss += 1
        continue
 
    s = sorted(s,reverse=True)
    #print(s)
    for j in range(i):
        if p[i] > s[j]:
            miss += 1
            break

print(n-miss)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
y=list(range(x))
y=list(map(int,input().split()))
c=0
d=True
for i in range(0,x):
  for l in range(0,i+1):
    if y[l]<y[i]:
      d=False
      break
  if d==True:
    c+=1
  else:
    d=True
  if y[i]==min(y):
    break
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
hoge = [input() for i in range(2)]
tmp = hoge[1].split()
num = int(hoge[0])

tmp = list(map(int,tmp))

flag = 1
count = 0
j = 1
for i in range(num):
    now_list = tmp[:j]
    if len(now_list) == len([piyo for piyo in now_list if piyo >= now_list[-1]]):
        count += 1

    j += 1


"""
for i in range(num):
    for j in range(i):
        if tmp[i] > tmp[j]:
            flag = 0

    if flag == 1:
        count += 1
    flag = 1
"""
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
ct=1
maxn=p.index(1)
for i in range(1,len(p)):
    if p.index(i+1)<maxn:
        maxn=p.index(i+1)
        ct+=1
print(ct)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

import sys
input=sys.stdin.readline

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0

for i in p:
    P.append(i)
    if i==min(P):
        cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
P=list(map(int,input().split()))
count=1
m=1000000000
for i in range(1,n):
    m=min(P[i],m)
    if P[i]>m:
        continue
    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())) 
res = len(p)
m = 100000000000000
for i in range(len(p)):
    if i == 0:
        continue
    else:
        if m < p[i]:
            res -= 1
            continue
        else:
            for j in range(i):
                if p[i] >= p[j]:
                   res -= 1
                   m = p[i]
                   break
print(res)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(len(hairetu)):
  pipod = hairetu[i]
  p = 0
  if i == 0:
    count = count + 1
  else:
    for j in range(i+1):
      if hairetu[j]>=hairetu[i]:
        p = p+1
    if p==i+1:
      count = 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(0,N):
    P_i = P[i]
    sub_count = 0
    for j in range(0,i + 1):
        P_j = P[j]
        if P_i <= P_j:
            sub_count += 1
        elif P_i > P_j:
            break
        
    if (i + 1) == sub_count:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
P = np.array(input().split(' '), dtype = int)

counta = 0
for i in range(N):
    counta += np.all((P[:i+1] >= P[i]))
print(counta)

Submission status: Time Limit Exceeded

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

for i in range(N):
	if min(P[0:i+1]) != P[i]:
		C -= 1
print(C)

Submission status: Time Limit Exceeded

Solution code:
import sys

n_in = input()
result = input().split()
total = 0
n_in = int(n_in)

for k0 in range(n_in):
    count = 0
    for l0 in range(k0):
        if int(result[k0]) <= int(result[l0]):
            count += 1
    if count == k0:
        total += 1

print(total)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=input().split()
NS = [int(i) for i in S]
def exist():
    s=0
    for i in range(N):
      cond=True
      for j in range(0,i):
         if NS[i]>NS[j]:
            cond=False
            break
      if cond:
        s+=1   
    return s
if __name__=='__main__':
   print(exist())

Submission status: Time Limit Exceeded

Solution code:
#C
N = int(input())
P = list(map(int, input().split()))
ans = 0
 
for i in range(N):
    frag = True
    for j in range(i):
        if P[i] > P[j]:
            frag = False
            break
    if frag == True:
        ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
ct=1
maxn=p.index(1)
for i in range(1,len(p)):
    if p.index(i+1)>maxn:
        pass
    else:
        maxn=p.index(i+1)
        ct+=1
print(ct)

Submission status: Time Limit Exceeded

Solution code:
loop = int(input())
num_list = list(map(int, input().split()))
before = []
ans = 0
for n in num_list:
  flg = True
  for m in before:
    if m < n:
      flg = False
      break
  before.append(n)
  if flg:
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

minus_count = 0
rember_list = []
for i, x in enumerate(c_list):
    if i == 0:
        rember_list.append(x)
        continue
    min_rember = min(rember_list)
    if x > min_rember:
        minus_count += 1
    rember_list.append(x)

print(len(c_list) - minus_count)

Submission status: Time Limit Exceeded

Solution code:
n,*p=map(int,open(0).read().split())
cnt=0
flg=True
for i in range(n):
  flg=True
  for j in range(0,i):
    if p[i]>p[j]:
      flg=False
      break
  if flg:
    cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(input())
lis = list(map(int,input().split()))
count = 0
for i,l in enumerate(lis):
    if i == 0:
        count += 1
    else:
        rs_lis = sorted(lis[0:i])
        if rs_lis[0] >= l:
            count += 1
print(count)

Submission status: Time Limit Exceeded

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

while True:
    if tmpMinIndex == 0:
        break
    li = li[0:tmpMinIndex]
    minNum = min(li)
    tmpMinIndex = li.index(minNum)
    count += 1


print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n = int(input())
p_arr = np.array(list(map(int, input().split())))
res = 0
for k, i in enumerate(p_arr):
  if i == 1 or k == 0:
    res += 1
  else:
    left_arr = p_arr[:k]
    b_arr = i > left_arr
    if not b_arr.any():
      res += 1
print(res)