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:
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

a=1
for i in range(1,N):
    if np.min(n[:i]) > n[i] : a+=1   
print(a)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

a=1
for i in range(1,N):
    if np.min(n[:i]) < n[i] : continue
    else: a+=1   
print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(ret)

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
P = LIST()

flag = [N+1]*N
total = 0

for i in range(1, N+1):
	num = P.index(i)
	if min(flag[0:num+1]) > P[num]:
		total += 1
	flag[num] = P[num]

print(total)

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
P = LIST()

flag = [N+1]*N
sortP = sorted(P)
total = 0

for i in range(1, N+1):
	num = P.index(i)
	if min(flag[0:num+1]) > P[num]:
		total += 1
	flag[num] = P[num]

print(total)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

a=1
for i in range(1,N):
    if np.count_nonzero(n[:i] < n[i]) : continue
    else: a+=1   
print(a)

Submission status: Time Limit Exceeded

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

count = 0 # p_j > p_i である回数
p_length = len(p_list)
for i in range(p_length):
    p_max = min(p_list[:i+1])
    if p_list[i]==p_max:
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

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

count = 0 # p_j > p_i である回数
for i in range(len(p_list)):
    p_max = min(p_list[:i+1])
    if p_list[i]==p_max:
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

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

count = 0 # p_j > p_i である回数
for i in range(len(p_list)):
    flag = False
    for j in  p_list[:i+1]:
        if p_list[i]<=j:
            flag = True
        else:
          flag = False
          break
    if flag:
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

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

loop_max = P.index(np.min(P))

count = 0
for i in range(loop_max+1):
    if P[i] == np.min(P[:i+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

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

count = 0
for i in range(N):
    if P[i] == np.min(P[:i+1]):
        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):
    state = 1
    for j in range(i):
        if p[i]<=p[j]:
            state = 1
        else:
            state = 0
            break
    if state == 1:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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


def solve(N: int, P: "List[int]"):
    cnt = 0
    for i in range(0, N):
        flag=True
        for j in range(0, i+1):
            if P[i] > P[j]:
                flag=False
                break
        if flag:
            cnt+=1
    return cnt


# 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]"
    print(solve(N, P))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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


def solve(N: int, P: "List[int]"):
    cnt = 0
    for i in range(0, N):
        flag=True
        for j in range(0, i+1):
            if P[i] > P[j]:
                flag=False
        if flag:
            cnt+=1
    return cnt


# 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]"
    print(solve(N, P))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
line = list(map(int,input().split()))
a = 0
p = []
for i in line:
    p.append(i)
    m = min(p)
    if m >= i:
       a += 1

print(a)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

res = 1

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

print(res)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

res = 1

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

print(res)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
line = list(map(int,input().split()))
a = 0
p = []
for i in line:
    p.append(i)
    if  min(p) >= i:
       a += 1

print(a)

Submission status: Time Limit Exceeded

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

print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = np.array(list(map(int, num[1].split())))

history = []
count = 0

for i in range(0,num_0):
    history.append(num_1[i])
    num_min = np.min(history)
    if(num_1[i] <= num_min):
        count = count + 1

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

ans = 1
for i in range(1, n):
    flag = True
    for j in range(i):
        if p[i] > p[j]:
            flag = False
            break
    if flag:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

count = 0

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

print(count)

Submission status: Time Limit Exceeded

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

ct = 0
for i in range(N):
    out = 0
    for j in range(i+1):
        if x[i] > x[j]:
            out = 1
            break
    if out == 0:
        ct += 1
print(ct)

Submission status: Time Limit Exceeded

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

count_i = 0
for i in sta:
    sta2.append(i)
    if i <= min(sta2):
        count_i += 1

print(count_i)

Submission status: Time Limit Exceeded

Solution code:

class Solution:
    def solve(self, n, arr):
        count = 0

        for i in range(n):
            j = 0
            flag = True

            while j <= i:
                if arr[j] < arr[i]:
                    flag = False
                    break

                j += 1

            if flag:
                count += 1

        return count


sol = Solution()

n = int(input().strip())
arr = list(map(int, input().strip().split(" ")))

print(sol.solve(n, arr))

Submission status: Time Limit Exceeded

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

count_i = 0
for i in range(0, N):
    for j in range(0, i):
        if sta[i] > sta[j]:
            count_i -= 1
            break
    count_i += 1

print(count_i)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

s = 1
for i in range(1,N):
  v = P[i]
  p = P[:i]
  p = p>=v
  a = p.sum()
  if a==i:
    s += 1
print(s)

Submission status: Time Limit Exceeded

Solution code:
#! usr/bin/env python3

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

Result = [lst[i] <= min(lst[:i + 1]) for i in range(N)]
print(Result.count(True))

Submission status: Time Limit Exceeded

Solution code:
#! usr/bin/env python3

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

TotalNum = 0
for i in range(N):
    if lst[i] <= min(lst[:i+1]):
        TotalNum += 1

print(TotalNum)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P_list=list(map(int, input().split()))
#print(P_list)
count=0
while P_list!=[]:
    minindex=P_list.index(min(P_list))
    P_list=P_list[0:minindex]
    count+=1
    
print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

counter = 0
for i in range(len(N_list)):
    if N_list[i] == min(N_list[:i+1]):
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!

from collections import deque

N = int(input())
P = deque(list(map(int, input().split())))
ctr = 0
Array = []

for i in range(N):
    Array.append(P.popleft())
    if Array[-1] == min(Array):
        ctr += 1
print(ctr)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  if min(b[0:i])>b[i]:
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  switch = 0
  for j in range(i-1,-1,-1):
    if b[i] > b[j]:
      switch = 1
      break
  if switch != 1:
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  switch = 0
  for j in range(0,i):
    if b[i] > b[j]:
      switch = 1
      break
  if switch != 1:
    c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  switch = 0
  for j in range(0,i):
    if b[i] > b[j]:
      switch = 1
  if switch != 1:
    c += 1
print(c)

Submission status: Time Limit Exceeded

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

for i in range(1,N + 1):
	pi = p[i - 1]
	if all(pi <= j for j in p[:i]):
		count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p = [int(e) for e in input().split(" ")]
c = 0
for i in range(N):
    if(p[i] <= min(p[0:i + 1])):
        c += 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    minP = min(P[:i+1])
    if P[i] == minP:
        count = 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(0,N):
    for j in range(0,i):
        if lists[i] > lists[j]:
            break
    else:
        count = count + 1
print(count)

Submission status: Time Limit Exceeded

Solution code:

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

count = 0
flag = False

for i in range(n):
    for j in range(i+1):
        if P[i] <= P[j]:
            flag = True
        else:
            flag = False
            break
    if flag == True:
        count += 1
    flag = False

print(count)

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 in range(n):
    if p[i] <= np.min(p[:i+1]):
    # if all(map(lambda pj: p[i] <= pj, p[:i + 1])):
        cnt += 1
        if p[i] == 1:
            break


print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main(n, p):

    cnt = 0

    for i in range(n):
        # print(f"pi={p[i]}, pj={p[:i+1]}")
        if all(map(lambda pj: p[i] <= pj, p[:i+1])):
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    n = int(input())
    p = list(map(int, input().split()))
    main(n, p)

Submission status: Time Limit Exceeded

Solution code:
a=int(input())

b=[]

b.append(input().rstrip().split(" "))

n=0

for i in range(a):
  m=0
  for j in range(i):
    if int(b[0][i]) <= int(b[0][j]):
      m+=0
    else:
      m+=1
  if m == 0:
   n+=1
    
print(n)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l1=input().split()
l=[int(x)for x in l1]
ans=0
for i in range(n):
    list_now=l[0:i+1]
    num_now=l[i]
    list_now.sort()
    if num_now==list_now[0]:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(N):
  isOK = True
  for j in range(i):
    if P[i] > P[j]:
      isOK = False
      break
  if isOK:
    ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

# i=1は必ずOK
c = 1

for i in range(1,N):
  n_i = P[i]
  p = P[:i+1]
  
  for j in range(i+1):
    if p[j] < n_i:
      break
      
  if j==i:
    c+=1
    
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import heapq as hp
n = int(input())
p = list(map(int, input().split(' ')))
res = 0
for i in range(n):
    q = []
    for j in range(i+1):
        hp.heappush(q,p[j])
    if hp.heappop(q) >= p[i]:
        res += 1
print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
 
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 = list(map(int, input().split()))
count = 0
for i in range(N):
    if p_list[i] == min(p_list[0:i+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p_list = str(input()).split()
for i in range(N):
    p_list[i] = int(p_list[i])
count = 0
for i in range(N):
    val_list = p_list[0:i+1]
    val = val_list[i]
    if val == min(val_list):
        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):
    flag = False
    if min(P[0:i+1])==P[i]:
        flag = True
    if flag == True:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

N = int(input())
input_list = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(i):
        if input_list[i] > input_list[j]:
            break
    else:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))  
B = [None]*N

for i in range(N):
  if all([A[v] >= A[i] for v in range(i)]): 
    B[i]=True
  else:
    B[i]=False

print(B.count(True))

Submission status: Time Limit Exceeded

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

for i in range(N):
  if all([A[v] >= A[i] for v in range(i)]): 
    B.append(True)
  else:
    B.append(False)

print(B.count(True))

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(N):
  if all([A[v] >= A[i] for v in range(i)]): 
    cnt = cnt +1

print(cnt)

Submission status: Time Limit Exceeded

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

count = 0

for i in range(N):
    minimum = min(Ps[:i + 1])
    if minimum == Ps[i]:
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[int(x) for x in input().split()]
q=[]
for i in range(n):
    if int(min(p[:i+1]))==int(p[i]):
        q.append(int(p[i]))
print(len(q))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[int(x) for x in input().split()]
q=[]
for i in range(n):
    if int(min(p[:i+1]))==int(p[i]):
        q.append(p[i])
print(len(q))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[int(x) for x in input().split()]
q=[]
for i in range(n):
    if min(p[:i+1])==p[i]:
        q.append(p[i])
print(len(q))

Submission status: Time Limit Exceeded

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

memory = []

count = 0

for i in range(N):
    if i in memory:
        break
    for j in range(i + 1):
        if Ps[i] > Ps[j]:
            memory.append(j)
            break
        if i == j:
            count+=1

print(count)

Submission status: Time Limit Exceeded

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

ok = [P[i] <= min(P[0:i]) for i in range(1, len(P))]
print(ok.count(True)+1)

Submission status: Time Limit Exceeded

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

count = 0

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

print(count)

Submission status: Time Limit Exceeded

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

cnt = 0
for i,e in enumerate(b):
    res = True
    for a in b[:i]:
        if a < e:
            res = False;break
    if res:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
def code(n,p):
    curmin = np.inf
    ans = 0
    for idx in range(1,len(p)+1):
        curmin = np.min(p[:idx])
        if curmin == p[idx-1]:
          ans+=1
    
    return ans

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

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
def code(n,p):
    mins = []
    for idx in range(1,len(p)+1):
        mins.append(np.min(p[:idx]))
        
    
    return sum(np.array(mins)==p)

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

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)

Submission status: Time Limit Exceeded

Solution code:
def code(n,p):
    flg = 1

    for idx in range(1,n):
        if min(p[0:idx]) >= p[idx]:
            flg+=1
    return flg

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

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)

Submission status: Time Limit Exceeded

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

count = 0
pre = p[0]
for i, now in enumerate(p):
    if now <=pre:
         count+=1
    pre = min(p[:i+1])
print(count)

Submission status: Time Limit Exceeded

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

sum = 0
for i in range(len(P)):
    for j in range(i+1):
        if P[i] > P[j]:
            sum += 1
            break

print(len(P)-sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(N):
  fulfill = True
  for j in range(i):
    if A[i] > A[j]:
      fulfill = False
      break
  if i == 0 or fulfill == True:
    count += 1
      
print(count)

Submission status: Time Limit Exceeded

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

for i in range(N):
  fulfill = True
#  print("A[i] " + str(A[i]))
  for j in range(i):
#    print("A[j] " + str(A[j]))
    if A[i] > A[j]:
      fulfill = False
  if i == 0 or fulfill == True:
    count += 1
      
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

cnt = 0
for i, n in enumerate(numbers):
    if min(numbers[:i+1]) == n:
        cnt += 1
    if n == 1:
        break
        
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input().rstrip().split(' ')
listP = [int(num) for num in tmp]
count = 0

for i, n_i in enumerate(listP):
    numi = True
    for j in range(0, i+1):
        n_j = listP[j]
        if n_i > n_j:
            numi = False
            
 
    if numi:
        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):
	for j in range(i+1):
		if p[i]<=p[j]:
			continue
		else:
			break
	else:
		ans = ans + 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
#P = [int(i) for i in input().split()]
P = list(map(int, 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:
def main():
  import numpy as np
  inp1 = input()
  inp2 = input().split()

  a = int(inp1)
  b = np.array(inp2).astype(int)
  ansno = a

  for ii,i in enumerate(b):
    bslice = b[:ii+1]
    minb = np.min(bslice)
    if minb == i:
      pass
    else:
      ansno -=1

  print(ansno)
if __name__ == '__main__':
  main()