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=[int(i) for i in input().split()]
a=0
for i in range(1,N):
    for j in range(i):
        if P[j]<P[i]:
            a=a+1
            break
        else:
            pass

print(N-a)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n=int(input())
p=np.array(list(map(int, input().split())))

cnt = 0
for i,v in enumerate(p):
    if i == 0:
        cnt += 1
        continue
    if np.min(p[:i]) > v:
        cnt += 1
print(cnt)

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):
    A.append(h[i])
    if min(A) >= h[i]:
        c += 1
print(c)

Submission status: Time Limit Exceeded

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

if N == 1 :
    print(1)
elif N > 1:
    for i in range(1,N) :
        flag = False
        for j in range (0,i) :
            if int(P[i]) <= int(P[j]):
                continue
            else : 
                flag = True
                break
        if not flag :
            count += 1
                
    print (count)
else : 
    print(0)

Submission status: Time Limit Exceeded

Solution code:
# C - Low Elements
n = (int)(input())

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

sum = 0
count = 0
for i in range(0, n):
    for j in range(0, n):
        if j <= i and array[i] <= array[j]:
            count += 1
    if count - 1 == i:
        sum += 1
    count = 0

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
tl = input().split()

l = [int(i) for i in tl]

mn = n

count = 0
for i in range(len(l)):
    if l[i] > mn:
        continue

    sl = l[0:i+1]
    mn = min(sl)
    count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
p = [int(x) for x in input().split()]

x = []
oklist = [0]

for i in range(1,n):
    res = "ok"
    for j in range(i):
        #print(j,i,p[j],p[i])
        if p[j] < p[i]:
            res = "ng"
    if res == "ok":
        oklist.append(i)

#print(oklist)
print(len(oklist))

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 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:
def solve(n, p_list):

    count = 1
    for i in range(n-1):
        target_num = p_list.pop()
        if min(p_list) > target_num:
            count += 1
    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(map(int, input().split())) 
res = len(p)
mm = False
m = 100000000000000000
ss = 0
for i in range(len(p)):
    if i == 0:
        continue
    else:
        if (mm == True) & (m <= p[i]):
            res -= 1
            continue
        elif ss >= p[i]:
            continue
                
        else:
            for j in range(i):
                if p[i] >= p[j]:
                    res -= 1
                    m = p[i]
                    mm = True
                    break
                if j == i:
                    ss = p[i]
print(res)

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())
P = [int(x) for x in input().split()]

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

        counter +=1

print(counter)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(ct)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
plis=list(map(int,input().split()))
ctr=0
while len(plis)!=0:
    lowctr=plis.count(min(plis))
    low=plis.index(min(plis))
    ctr+=lowctr
    plis=plis[:low]
print(ctr)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lis = list(map(int, input().split()))
 
for a, b in enumerate(lis):
    if b != min(lis[:a+1]) :
        n -= 1
print(n)

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()))

ans = 0
for i in range(int(len(p))):
  temp = 0
  #print("i =",i)
  for k in range(i+1): 
    #print("k = ",k)
    if(p[i]>p[k]):            
      break
    temp += 1
    #print("temp=",temp) 
    if ( temp == i+1):
      ans += 1
  #print("ans=",ans)    
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
#https://atcoder.jp/contests/abc152/tasks/abc152_c
# -*- coding: utf-8 -*-
N = int(input())
P = input().split()
T = []
L =[0]*(N-1)
L.insert(0,1)
T.insert(0,int(P[0]))
for i in range(len(P)):
  P[i] = int(P[i])
for i in  range(1,len(P)):
  if P[i]<=P[i-1]:
    if min(T)>P[i]:
      L[i] = 1
    T.append(P[i])
print(L.count(1))

Submission status: Time Limit Exceeded

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

counter = 1

# for i in range(2, len(P) + 1, 1):
#     for j in range(i):
#         if P[j] < P[i-1]:
#             break
#     else:
#         counter += 1

for i in range(2, len(P) + 1, 1):
    sl = slice(i)
    # print(P[sl])
    # print(P[i-1])
    if all(elem >= P[i-1] for elem in P[sl]):
        counter += 1

print(counter)

Submission status: Time Limit Exceeded

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

counter = {"check": 0}

for i in range(0,N):
    count = len([j for j in range(i) if num_list[j] < num_list[i]])
    if count == 0:
        counter["check"] += 1

print(counter["check"])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 0
for i in seq:
  number_loop = len(seq[0:seq.index(i)+1])
  for idx, j in enumerate(seq[0:seq.index(i)+1]):
    if i > j:
      break
    if idx+1 == number_loop:
      count += 1
      
print(count)

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 any( x< P[i] for x in  P[0:i] ):
        pass
    else:
        counter +=1

print(counter)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = tuple(map(int, input().split()))
cnt = N
for a in P:
    for b in P[:P.index(a)+1]:
        if a > b:
            cnt -= 1
            break
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = map(int,input())
N_list = list(map(int,input().split()))
counter = 0
tmp = []
for i in range(len(N_list)):
    target = N_list[i]
    tmp.append(target)
    if min(tmp) == target:
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
iP = input().split(' ')

P = [int(p) for p in iP]

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

print(count)

Submission status: Time Limit Exceeded

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

islow = True
counter = 0
min = 0

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

Submission status: Time Limit Exceeded

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

for i in range(n):
  L2 = List[0:i+1:]
  if List[i] <= min(L2):
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
#front small ng
def checkFront(start,a):
  nowIndex = start
  for i in range(len(a)):
    #print("hikaku",a[start],a[nowIndex])
    if(a[start] > a[nowIndex]):
      #print("out")
      return 0
    else:
      if(nowIndex == 0):
        #print("ok")
        return 1
      else:
        nowIndex -= 1

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

ans = 0

for i in range(n):
  ans += checkFront(i,a)
  #print(i,ans)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
inp1 = input().split()
inp2 = input().split()
a = int(inp1[0])
b = inp2
b = [int(s) for s in inp2]
ansno = a
#print("b: ",b)
#print("b[:3] ",b[:3])
#print("b[:0] ",b[:0])
ii = 0
#print("b[:ii+1] ",b[:ii+1])
for i in b:
  if i ==0:
    continue
#  print(i)
  jj = 0
  for j in b[:ii]:
    if i >= j:
#      print(i, ">=", j,"break")
      ansno -= 1
#      print("ansno: ",ansno)
      break
    else:
      jj+=1
  ii+=1
#print("final ansno: ",ansno)
print(ansno)

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 = int(N)
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:
import numpy as np

N = input()
P = [ int(n) for n in input().split()]
count = 0

for i, p in enumerate(P):
    if np.min(P[:i+1]) >= p:
        count = count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
mylist=list(map(int,input().split()))
    
#print(mylist)
answer=0

#2重forループでは重すぎるのでTLEになる。

i=0
while i<N:
    flag=0
    
    for j in range(i):
        #print("iは")
        #print(i)
        #print("jは")
        #print(j)
        if mylist[i]>mylist[j]:
            #一つでも条件満たさないjがあればflagを-1にする
            flag=-1
            break

    if flag==0:
        #flagが0であれば、そのiに対して答えを+1する
        answer+=1
    
    i+=1
        
print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print (count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys


def main():
    n = int(input())
    tmp = input().split(" ")
    p = []
    cnt = 0
    for i in range(n):
        p.append(int(tmp[i].replace('\n', '')))
    for i in range(2, n + 1):
        p2 = sorted(p[0:i - 1])
        if p2[0] < p[i - 1]:
            cnt += 1
    print(n - cnt)


if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

res = 1
for i in range(1, n):
    if min(p[:i]) < p[i]:
        continue
    else:
        res += 1

print(res)

Submission status: Time Limit Exceeded

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

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 or A[j] == 1:
            ans += 1
            break

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        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:
import numpy as np
N=int(input())
P=np.array(list(map(int, input().split())))



mini=1
count=1
index_min=P.argmin()
while P[0]>mini:
  P=P[:index_min]
  mini=min(P)
  index_min=P.argmin()
  count+=1
"""
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 = input().split(" ")
list(map(int ,p))

ans = 0
for i in range(n):
    seikai = True
    for j in range(i+1):
        if int(p[j]) - int(p[i]) < 0:
            seikai = False
    if seikai:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

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

R = [0 for i in range(N)]
cnt = 0
for i in range(N):
    f = True
    for j in range(i+1)[::-1]:
        if P[i] > P[j]:
            f = False
            R[i] = 2
            break
        elif P[i] >= P[j] and R[j] == 1:
            break
    if f:
        cnt += 1
        R[i] = 1

print(cnt)

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]
pre_min = 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
    if pre_min < P[i]:
        #print(i, j, pre_min)
        #pre_min = P[j]
        SUCCESS -= 1
        continue
    while j >= 0:
        if pre_min > P[j]:
            pre_min = P[j]      
        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()))
cnt = 1
for _ in range(1,n):
    for j in range(_):
        if p[_] <= p[j]:
            if _ == j+1:
                cnt += 1
        else:
            break
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

double = np.array([P for i in range(N)])
ar_P = np.array(P).reshape(-1,1)
ar_bool = (double < ar_P)
for i in range(N):
    N -= np.any(ar_bool[i][:i+1])
print(N)

Submission status: Time Limit Exceeded

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

ans = 0
min_v = N
for i in range(0, N):
    if P[i] > min_v:
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = P[i]

print (ans)

Submission status: Time Limit Exceeded

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

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = input()
P = [ int(n) for n in input().split()]
count = 0

for i, p in enumerate(P):
    if np.amin(P[:i+1]) >= p:
        count = count+1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def check(target_num, num_list):
    for i in num_list:
        if i < target_num:
            return 0
    return 1

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

count = 0

for i in range(n):
  correct = True
  for j in range(i+1):
    
    if p[i] > p[j]:
      correct = False
      break;
  
  if correct:
    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):
  for j in range(0, i):
    if P[j] <= P[i]:
      count +=1
      break

count = N-count

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(i) for i in input().split()]
num = 1
for i in range (1,N):
    less = True
    for j in range(i):
        if(P[j]<P[i]):
            less = False
            break
    if(less):
        num +=1
print(num)

Submission status: Time Limit Exceeded

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

count1=0
count2=0

for j in range(0,N):
    for i in range(0,j):
        if p[j]<=p[i]:
            count1+=1
    if count1==j:
        count2+=1
    count1=0

print(count2)

Submission status: Time Limit Exceeded

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

for i in range(n):
  kkk = ( 1<<(a[i]-1) ) -1
  if bit&kkk == 0:
    ans += 1
  bit += 1<<(a[i]-1)
  
    
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

l = list(map(int,input().split()))
#print(l)

ans = 0
sv = []
for i in l:
    sv.append(i)
    if i <= min(sv):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

L2 = []

for i in range(n):
  L2.append(List[i])
  if List[i] <= min(L2):
    count += 1
print(count)

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):
    Flag = True
    for j in range(i+1):
        if P_s[i] > P_s[j]:
            Flag = False
            break
    if Flag == True:
        output_s += 1

print(output_s)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
iP = input().split(' ')

P = []
for i in range(len(iP)):
    P.append(int(iP[i]))

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

print(count)

Submission status: Time Limit Exceeded

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


def solve(N: int, P: "List[int]"):

    result = 0
    min_num = min(P)
    min_index = P.index(min_num)
    P = P[: min_index + 1]
    for i in range(len(P)):
        if P[i] == min(P[: i + 1]):
            result += 1
        else:
            pass
    print(result)

    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:
x=int(input())
y=list(range(x))
y=list(map(int,input().split()))
c=0
d=y[0]
for i in range(0,x):
  if d>=y[i]:
    c+=1
    d=y[i]
    if d==min(y):
      break
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for  i in range(N):
  if a.count(i+1)>0:
    a=a[0:a.index(i+1)]
    b+=1
print(b)

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, readline().split()))
cnt = 0
for i in range(n):
    if all(p[i]<=p[j] for j in range(i+1)):
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

cut = N
check =0
for i in range(1,N+1):
    for k in range(1,i+1):
        if List[k-1]<List[i-1]:
            check = 1
            break
    if check==1:
        cut -= 1
    check = 0

print(cut)

Submission status: Time Limit Exceeded

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

ans = 0
min_v = N

for i in range(0, N):
    if P[i] > min_v: continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = P[i]

print (ans)

Submission status: Time Limit Exceeded

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

x = list(range(1, n+1))

cnt = 0
for i in p:
    if x.index(i) == 0:
        cnt += 1
    x.remove(i)

print(cnt)

Submission status: Time Limit Exceeded

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

ch=[set(list(range(1,i+2))) for i in range(n)]
#print(ch)
ans=1
s={num[0]}
st=set()
for i in range(1,n):
  #print(s)
  if ch[num[i]-1] & s == st:
    ans+=1
  s.add(num[i])
#print(set(list(range(8))))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split())) 
res = len(p)
mm = False
m = 100000000000000000
for i in range(len(p)):
    if i == 0:
        continue
    else:
        if (mm == True) & (m <= p[i]):
            res -= 1
            continue
        else:
            for j in range(i):
                if p[i] >= p[j]:
                    res -= 1
                    m = p[i]
                    mm = True
                    break
print(res)

Submission status: Time Limit Exceeded

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


# 最小値更新して越えてたらアウト
resultCount = 0
minNum = P[0]
for i in range(N):
    isMitasu = True
    if i != 0:
        if P[i] > minNum:
            isMitasu = False
        else:
            for j in range(i):
                if P[i] > P[j]:
                    isMitasu = False
                    # 最小値更新
                    if P[i] < minNum:
                        minNum = P[i]
                    break
    if isMitasu:
        resultCount += 1
print(resultCount)

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]:
      tof = False
      break
  if tof:
    count += 1
  else:
    tof = True
  
print(count)

Submission status: Time Limit Exceeded

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

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

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

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:
    sub_hairetu = [hairetu[j] for j in range(i+1) if hairetu[j]>=pipod]
    if len(sub_hairetu)>=i+1:
      count = count+1

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
        else:
            break
    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()))
c = 1

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

print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

P_list = input().split()

P_list_int = [int(p) for p in P_list]


correct_cnt = 0
for i in range(N):
    for j in range(i+1):
        if(P_list_int[i]>P_list_int[j]):
            break

        if(j == i):
            correct_cnt += 1

print(correct_cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

l = list(map(int,input().split()))
#print(l)

ans = 0
count = 0
sv = []
for i in l:
    sv.append(i)
#    print(sv,i)
    for j in sv:
 #       print(i,j)
        if i <= j:
            count += 1        
    
    if len(sv) == count:
        ans += 1
        
    count = 0
    
print(ans)

Submission status: Time Limit Exceeded

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

j = 1
temp = p_list[0]
for i in range(1,N):
  if p_list[i] > temp:
    continue
  sort_list = sorted(p_list[0:i+1])
  if p_list[i] <= sort_list[0]:
    j = j + 1
  else:
    temp = p_list[i]

print(j)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
Ps = list(map(int, input().split()))
Ps = np.array(Ps)
count = 0
low = -1

for i in range(N):
    low = Ps[i]

    if ( np.any(Ps[:i] < low) ):
        continue
    else :
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
plis=list(map(int,input().split()))
lowctr=plis.count(min(plis))
low=plis.index(min(plis))
ctr=lowctr
if low!=0:
    ctr+=1
plis=plis[:low]
for i in range(1,len(plis)):
    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()))
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()))
result = 0
for i in range(N):
    if P[i] == min(P[:i+1]):
        result += 1
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

    ans = 1

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

cut = N
check =0
for i in range(1,N+1):
    for k in range(1,i+1):
        if List[k-1]<List[i-1]:
           check = 1
    if check==1:
        cut -= 1
    check = 0

print(cut)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
iP = input().split(' ')

P = []
for i in range(len(iP)):
    P.append(int(iP[i]))

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

print(count)

Submission status: Time Limit Exceeded

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

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