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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
b = c[0]

for i in range(1,n):
    if b >=c[i]:
        b = c[i]
        ans +=1
    else:
        pass

print(ans)

Submission status: Accepted

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

INF = 10 ** 18
A = [0] * N
mn = INF
for i, p in enumerate(P):
    if p < mn:
        mn = p
        A[i] = p
    else:
        A[i] = mn

ans = 0
for i, p in enumerate(P):
    if A[i] >= p:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#41
import math
N = int(input())
p = list(map(int,input().split()))

cou = 0
x = math.inf

for j in range(N):
    if min(x,p[j]) == p[j]:
        x = p[j]
        cou += 1

print(cou)

Submission status: Accepted

Solution code:
n=int(input(""))
pp=input("").split(" ")
latest=n
s=0
for i in range(n):
    tmp=int(pp[i])
    if (tmp<=latest):
        latest=tmp
        s+=1

print(s)

Submission status: Accepted

Solution code:
N = int(input())
low = 10 ** 6
ans = 0
for p in map(int, input().split()):
    if p <= low:
        low = p
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0
    min = N+1

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

    print(ans)

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input(''))
p=list(map(int,input('').split(' ')))
s=1
mi=p[0]
for a in range(n-1):
    if p[a+1]<=mi:
        s=s+1
        mi=p[a+1]

print(s)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    Min = [10**9]
    ans = 0
    for i in range(n):
        Min.append(min(Min[-1],p[i]))
    for i in range(n):
        if Min[i]>p[i]:
            ans += 1
    print(ans)
main()

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0
m = p[0]

for i in p:
    m = min(m, i)
    if m == i:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
x = 200_001
P = list(map(int, input().split()))
cnt = 0
for p in P:
    if p < x:
        cnt += 1
        x = p
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n, s, c = int(input()), list(map(int, input().split())), 0
m = s[0]
for i in range(n):
	if s[i] <= m: m = s[i]; c += 1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
prev_min = P[0]
for p in P:
    if prev_min >= p:
        ans += 1
        prev_min = p
print(ans)

Submission status: Accepted

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

last_ok_postion = 0 
count = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

Solution code:
n, *aa = map(int, open(0).read().split())
# aa = aa
bb = []

tmp = aa[0]
for a in aa:
    tmp = min(a,tmp)
    bb.append(tmp)

# bb = bb[:-1]

print(sum([a<=b for a, b in zip(aa, bb)]))

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
mini = 10000000000000
ansL = [0]*N


for i in range(N):
    if P[i] <= mini:
        ansL[i] = 1
        mini = P[i]

print(ansL.count(1))

Submission status: Accepted

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

ans = 0
n = P[0]

for i in P:
    if n >= i:
        ans += 1
        n = i

print(ans)

Submission status: Accepted

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

for i in p:
    if i <= min_p:
        min_p = i
        ans += 1

print(ans)

Submission status: Accepted

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

ans = 0
min_p = P[0]

for p in P:
    if min_p >= p:
        min_p = p
        ans += 1

print(ans)

Submission status: Accepted

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

Min = float('inf')
cnt = 0
for i in range(N):
    if P[i] <= Min:
        cnt += 1
        Min = P[i]

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans=1
m=l[0]
for i in l[1:]:
  if i<=m:
    m=i
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list([int(x) for x in input().split()])
count = 0

min_a = N+1

for a in A:
    if a == min(min_a, a):
        count += 1
        min_a = a

print(count)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    P = list(map(int, input().split()))
    c = 0
    mn = P[0]
    for i in range(n):
        if mn >= P[i]:
            c += 1
            mn = P[i]
    print(c)
resolve()

Submission status: Accepted

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

  minP = 1000000000000000000000
  cnt = 0
  
  for i in range(N):
    if P[i] <= minP:
      minP = P[i]
      cnt += 1
  
  print(cnt)
  
  
  
main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n,*p=map(int,open(0).read().split())
c=0
n+=1
for i in p:
    n = min(n, i)
    if i<=n:
        c+=1
print(c)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = [0] + list(map(int, input().split()))
    L = [0]*(N+1)
    cnt = 0
    mi = 10**10
    for i in range(1,N+1):
        mi = min(mi,P[i])
        if mi == P[i]:
            cnt+=1

    print(cnt)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))
N = int(input())

p = LI()

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int, input().rstrip().split()))
mina=10**6
ans=0
for a in arr:
  mina=min(a,mina)
  if a <= mina:
    ans+=1
print(ans)

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

import io
import sys
import math

def solve(n, p_lst):
    # implement process
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
            if xmin == 1:
                break
    return cnt

def main():
    # input
    n = int(input())
    p_lst = list(map(int, input().split()))
    
    # process
    ans = str( solve(n, p_lst ) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Submission status: Accepted

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

import io
import sys
import math

def solve(n, p_lst):
    # implement process
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
    return cnt

def main():
    # input
    n = int(input())
    p_lst = list(map(int, input().split()))
    
    # process
    ans = str( solve(n, p_lst ) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Submission status: Accepted

Solution code:
N = int(input())
P_s = list(map(int, input().split()))
MIN = 10**10
answer = 0
for P in P_s:
    if MIN >= P:
        MIN = P
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

Solution code:
N = int(input())
Pmin = 200000
count = 0
for P in input().split():
    P = int(P)
    if P <= Pmin:
        count += 1
        Pmin = P
print(count)

Submission status: Accepted

Solution code:
n = int(input())
p_li = [int(w) for w in input().split()]

ans = 0
used_min = 2000000

for p in p_li:
    if p <= used_min:
        ans += 1
        used_min = p

print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *P = map(int, read().split())

    min_p = INF
    ans = 0
    for p in P:
        if p < min_p:
            ans += 1
            min_p = p

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
_ = int(input())
lp = list(map(int, input().split()))

m = 10 ** 6
answer = 0
for p in lp:
    m = min(m, p)
    answer += int(p <= m)

print(answer)

Submission status: Accepted

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

M=N+1
K=0
for a in P:
    if a<=M:
        M=a
        K+=1
print(K)

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
nowmin = 10 ** 9
res = 0
for i in range(n):
  if nowmin >= lst[i]:
    res += 1
    nowmin = lst[i]
print(res)

Submission status: Accepted

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

ans=0
mini=n+1

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

print(ans)

Submission status: Accepted

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

for i in range(N):
  if min(comp, A[i])==A[i]:
    ans+=1
    comp=A[i]
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))
    
    ans = 1
    tmp = inlis[0]
    for i in range(1, n):
        if inlis[i] < tmp:
            ans += 1
            tmp = inlis[i]
    print(ans)

    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

mi = 10 ** 6
cnt = 0

for a in A:
    mi = min(mi, a)
    if a == mi:
        cnt += 1
print(cnt)

Submission status: Accepted

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

for i in A:
  if i <= min_A:
    min_A = i
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = N + 1
for p in P:
    if res < p:
        continue
    cnt += 1
    res = min(res, p)
print(cnt)

Submission status: Accepted

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

count = 0
m = p[0]

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

print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-06-29 12:19:58 +0900
# LastModified: 2020-06-29 12:34:39 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


def main():
    n = int(input())
    p = list(map(int, input().split()))
    cnt = 1
    p_min = p[0]
    for i in range(1, n):
        if p_min > p[i]:
            cnt += 1
            p_min = p[i]

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

import sys
input = sys.stdin.readline

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    P = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    mini = [IINF]
    for i in range(N):
        mini.append(min(mini[-1],P[i]))
    ans = 0
    for i in range(N):
        if mini[i+1] == P[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import copy

N = int(input())
P = [int(x) for x in input().split()]
mano = []
min = N+1
for i in range(N):
    if P[i] < min:
        min = P[i]
    mano.append(min)

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

Submission status: Accepted

Solution code:
N = int(input())

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

cnt = 1
min_num = P[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
mini = pn[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    min_p = 1_000_000_000
    count = 0
    for p in P:
        if p < min_p:
            count += 1
            min_p = p
    
    print(count)

main()

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
Q = [P[0]]
for i in P[1:]:
    if i < Q[-1]:
        Q.append(i)
print(len(Q))

Submission status: Accepted

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

min_num = float("inf")
count = 0
for i in range(N):
    if P[i] < min_num:
        min_num = P[i]
    if P[i] == min_num:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

min=p[0]
ans=0

for i,v in enumerate(p):
	if min>=v:
		min=v
		ans+=1


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(cnt)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

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

q_list = np.minimum.accumulate(p_list)
ans = np.count_nonzero(q_list == p_list)

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

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

ans = 0
temp_min = MOD
for i in p_list:
    if i <= temp_min:
        temp_min = i
        ans += 1

print(ans)

Submission status: Accepted

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

minimum = N + 1
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
minP = N+1
for P in Ps:
    if minP >= P:
        ans += 1
        minP = P

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
ans=1 ; minn=a[0]
for i in range(1,n):
    if a[i]<=minn:
        ans+=1
        minn=a[i]
print(ans)

Submission status: Accepted

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

min = p[0]
count = 0

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
class BinaryIndexedTree:
    def __init__(self,n,default = 0):
        self.s = [default]*(n+1)
        self.n = n
    # idxは1-indexted
    def add(self,val,idx):
        while idx < self.n+1:
            self.s[idx] = self.s[idx] + val
            idx += idx&(-idx)
        return
    
    def get(self,idx):
        res = 0
        while idx > 0:
            res = res + self.s[idx]
            idx -= idx&(-idx)
        return res

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

BIT = BinaryIndexedTree(n)
ans = 0
for p in P[::-1]:
    ans += (BIT.get(p) >= p-1)
    BIT.add(1,p)
print(ans)

Submission status: Accepted

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()))
temp = p[0]
lis = p[1:]
ans = 1

for i in lis:
    if (i > temp):
        pass
    else:
        temp = i
        ans += 1

print(ans)

Submission status: Accepted

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

num = p[0]
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    ma=10**6
    tot=0
    for a in A:
        if a<=ma:
            tot+=1
            ma=a
    print(tot)




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

    minimum = INF
    ans = 0
    for i in range(n):
        if minimum >= P[i]:
            minimum = P[i]
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


curr_min = pl[0]
ans = 0
for p in pl:
    if p <= curr_min:
        ans += 1
        curr_min = p

print(ans)

Submission status: Accepted

Solution code:
n,*l=map(int,open(0).read().split())
t,c=n+1,0
for i in l:
  if i<t: t=i; c+=1
print(c)