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: Wrong Answer

Solution code:
N=input()
P=[float("inf")]+map(int, raw_input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
ans = [0]*N
ans[0] = 1
for i in range(N-1):
    if P[i+1] <= P[i]:
        ans[i+1] = 1
print(sum(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    a = list(map(int, r.split()))
    #a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]

    res = 1
    for i in range(1,len(a)):
        if a[i-1] < a[i]:
            continue
        else:
            res += 1
    print(res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

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

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

    if pn[i-1] >= pn[i]:
        ans += 1
        continue

print(ans)

Submission status: Wrong Answer

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

count = 0

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

print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=a[::-1]
def LIS(L):
    from bisect import bisect
    seq=[]
    for i in L:
        pos=bisect(seq,i)
        if len(seq)<=pos:
            seq.append(i)
        else:
            seq[pos]=i
    return len(seq)
print(LIS(a))

Submission status: Wrong Answer

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

lowest = 2 * 10 ** 5 + 1000
cnt = n
for i in range(n):
    if lowest < p[i]:
        cnt -= 1
    lowest = p[i]
print(cnt)

Submission status: Wrong Answer

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

for i in range(n):
  for j in range(i):
    sort_l.append(p[j])
  sort_l.sort()
  #print(sort_l[-1],p[i])
  if sort_l[-1]>= p[i]:
    cnt+=1
  sort_l = [0]
print(cnt)

Submission status: Wrong Answer

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

h = []
heapq.heapify(h)
ans=0
for i in range(len(p)):
    heapq.heappush(h,p[i])
    m = heapq.heappop(h)
    if m==p[i]:
        ans+=1
        heapq.heappush(h,m)
print(ans)

Submission status: Wrong Answer

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

mx = 0
ans = 0
for i in a:
    if i<=mx:
        ans+=1
    mx = max(mx,i)
print(ans)

Submission status: Wrong Answer

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

max = p[0]
c = 0

for smp in p:
  if(max < smp):
    max = smp
  else:
    c+= 1

print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = input().split()
ll = []
a = 0
for i in l:
  k = i
  ll.append(k)
  if min(ll) == k:
    a += 1
print(a)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

m = 2 * 10**5
ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

p_n = list(input().split())


result = 0
for x in range(N):
    if p_n[x] == min(p_n[0:x+1]):
        result += 1

print(result)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
p = list(map(int, input().split()))
p_diff = np.diff(p)
cnt = 1
for x in p_diff:
  if(x <= 0):
    cnt += 1
print(cnt)

Submission status: Wrong Answer

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

cnt = 0
for i in range(n-1):
    if L[i]>=L[i+1]:
        cnt +=1
print(cnt+1)

Submission status: Wrong Answer

Solution code:
import bisect
def lis_broad_sence(A):
    INF = 10**9
    N=len(A)
    dp = [INF] * (N+1) 
    for a in A:
        idx = bisect.bisect_right(dp,a)
        dp[idx] = a

    answer = bisect.bisect_left(dp, INF)
    return answer
n = int(input())
seq = list(map(int,input().split()))
seq.reverse()
print(lis_broad_sence(seq))

Submission status: Wrong Answer

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

import bisect

LIS = [seq[0]]
for i in range(len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]

print(len(LIS))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

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

sum = 1

for kk in range(n-1):
    if a[kk] >= a[kk + 1]:
        sum += 1

print(sum)

Submission status: Wrong Answer

Solution code:
import bisect

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

    ans = 0

    for i in range(N):
        l = bisect.bisect_left(P, P[i], hi=i)
        if l == 0:
            ans += 1

    print(ans)

    return 0

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left

def lis():
    n=int(input())
    p=[int(i) for i in input().split()]
    A=p[::-1]
    L = [A[0]]
    for a in A[1:]:
        if a > L[-1]:
            # Lの末尾よりaが大きければ増加部分列を延長できる
            L.append(a)
        else:
            # そうでなければ、「aより小さい最大要素の次」をaにする
            # 該当位置は、二分探索で特定できる
            L[bisect_left(L, a)] = a
    print(len(L))

lis()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
tmp = 0
for i in P:
  if i < tmp:
    ans += 1
  tmp = i
print(ans + 1)

Submission status: Wrong Answer

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

cum_min = [0] * n

min_p = 1e9
for i in range(n):
    cum_min[i] = min(min_p, ps[i])

count = 0
for i in range(n):
    if i == 0:
        count += 1
    else:
        if cum_min[i - 1] > ps[i]:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
ans = [0]*N
ans[0] = 1
for i in range(N-1):
    if P[i+1] <= P[i]:
        ans[i+1] = ans[i]+1
    else:
        ans[i+1] = ans[i]
print(ans[-1])

Submission status: Wrong Answer

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]):
            ans += 1
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
p = list(map(int, input().split()))
p_diff = np.diff(p)
cnt = 1
for x in p_diff:
  if(x < 0):
    cnt += 1
print(cnt)

Submission status: Wrong Answer

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

ans = 1

for j in range(N-1):
    if P[j] >= P[j+1]:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def MS(): return map(str, input().split())

YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = False
show_flg = True

p = None
XY = None
N = None


def main():
    N = I()
    P = LI()
    MP = [0] * N
    ans = 0

    for i in range(N):
        if i == 0:
            MP[i] = P[i]
        else:
            MP[i] = min(P[i-1], P[i])

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

    print(ans)
    # print(MP)
    # print(P)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import bisect
n = int(input())
p_ls = [int(i) for i in sys.stdin.readline().split()]
count = 0
p_ls.reverse()
ls = [10**18]
cnt = 0
_max = 0
for p in p_ls:
    ind = bisect.bisect_left(ls, p)
    if ind == len(ls):
        ls.append(p)
    else:
        ls[ind] = p
    _max = max(ind, _max)
print(_max + 1)

Submission status: Wrong Answer

Solution code:
def search(ind):
    _lst = [p_ls[ind]]
    for i in range(ind+1,n):
        if _lst[len(_lst)-1] >= p_ls[i]:
            _lst.append(p_ls[i])
    #print(len(_lst))
    return len(_lst)

n = int(input())
p_ls = list(map(int, input().split()))
sub_cnt = 1
for i in range(n):
    sub_cnt = max(sub_cnt,search(i))
print(sub_cnt)

Submission status: Wrong Answer

Solution code:

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

sum = 1

for kk in range(n-1):
    if a[kk] > a[kk + 1]:
        sum += 1

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import io

sys.stdin = io.StringIO(
    """5\n4 2 5 1 3"""
)

# ======================================================================

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

mn = 9999999999
ct = 0
for i in range(n):
    if mn > a[i]:
        ct += 1
        mn = a[i]
print(ct)

Submission status: Wrong Answer

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

ans = 200000
count = 0

for i in range(n):

    if p[i] < ans:
        count += 1
        ans = p[i]

print(count)

Submission status: Wrong Answer

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left

sys.setrecursionlimit(10**7)
N = int(input())
P = list(map(int, input().split()))

rP = list(reversed(P))
seq = rP.copy()

LIS = [seq[0]]
for i in range(len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect_left(LIS, seq[i])] = seq[i]

print(len(LIS))

Submission status: Wrong Answer

Solution code:
import bisect
n = int(input())
seq = list(map(int,input().split()))
seq.reverse()

LIS = [seq[0]]
for i in range(len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]

print(len(LIS))

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [int(x) for x in input().split()]
ans = 0
for i in range(1, n):
    l = p[i]
    for j in range(i):
        if p[j] >= l:
            ans += 1
            break
        else: continue
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 0
b4 = -1000000000
for i in a:
    if(b4 <= i):
        ans+=1
    b4=i
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np


DEBUG = True
dprint = print if DEBUG else lambda *x : x

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

minnum = 3 * 10^5
ans = 0
for i in P:
    if i <= minnum:
        minnum = i
        ans += 1

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 0
max_num = INF
for i in P:
    if i<=max_num:
        ans += 1
    max_num = i
print(ans)

Submission status: Wrong Answer

Solution code:
import heapq
def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    now = []
    heapq.heapify(now)
    ans = 0
    for i in range(N):
        heapq.heappush(now,P[i])
        if heapq.heappop(now)==P[i]:
            ans += 1
        heapq.heappush(now,P[i])
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int, input().split()))
minP = [float('inf') for _ in range(N)]
ans = 0
for idx, p in enumerate(P):
    if idx == 0:
        minP[idx] = p
    else:
        minP[idx] = min(P[idx-1], p)

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

print(ans)

Submission status: Wrong Answer

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N = one_int()

P=many_int()

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from bisect import bisect

N, *P = map(int, open(0).read().split())

INF = 10 ** 6
dp = [INF] * (N + 1)
for i in range(N):
    dp[bisect(dp, -P[i])] = -P[i]
    
print(sum(dp[i] < INF for i in range(N)))

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int,input().split()))
curmin = float('inf')
ans = 0
for p in P:
    if p <= curmin:
        ans += 1
    curmin = p
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, P):
    c = 0
    ans = 0
    for i in range(1, N):
        if P[i-1] < P[i]:
            c += 1
        else:
            ans += c
            c = 0
    ans += c
    return N - ans


def main():
    N = read_int()
    P = read_int_n()
    print(slv(N, P))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
b4 = -1000000000
for i in a:
    if(b4 < i):ans+=1
    b4=i
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(map(int,input().split()))

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

flag = [1 for i in range(N)]
for i in range(1, N):
  for j in range(i):
    if P[i] > P[j]:
      flag[i] = 0
print(sum(flag))

Submission status: Time Limit Exceeded

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

flag = [1 for i in range(N)]
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      flag[i] = 0
print(sum(flag))

Submission status: Time Limit Exceeded

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

for i in range(1, n):
    new = p[:i]
    m = sorted(new)
    #print('{}, {}'.format(m[0],p[i]))
    if p[i] < m[0]:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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

for i in range(N):
    T[i] = min([P[0]]+P[:i])

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    n = int(input())
    numbers=list(map(int,input().split()))
    count=0

    for idx,data in enumerate(numbers):
        if idx == 0:
            count+=1
        elif min(numbers[0:idx+1])==data:
            count+=1
        else:
            continue
    print(count)

if __name__=="__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    check = P[:i+1]
    if min(check) == P[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):
    check = P[:i+1]
    if min(check) == check[-1]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = N

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

print(ans)

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P_ls = list(map(int, input().split(' ')))
rst = 0
for i in range(N):
    val = P_ls[i]
    if min(P_ls[: i + 1]) == val:
        rst += 1
print(rst)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P_ls = list(map(int, input().split(' ')))
rst = 0
for i in range(N):
    val = P_ls[i]
    is_suc = True
    for j in P_ls[: i + 1]:
        if j < val:
            is_suc = False
            break
    if is_suc:
        rst += 1
print(rst)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

n = int(input())
p = np.array(list(map(int, input().split())))
cnt = 0
for num, i in enumerate(p):
    if np.all((p[:num]-i) > 0):
        cnt += 1

print(cnt)

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(input())
p = list(map(int, input().split()))
cnt = 0
for num, i in enumerate(p):
    flag = 1
    for j in p[:num]:
        if j < i:
            flag = 0
            break
    if flag:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:

def main():
    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)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

print(t)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

cnt = 1

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

print(cnt)

Submission status: Time Limit Exceeded

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

# i=1 では必ず成り立つので i>=2 から調べる
s = 1
for i in range(1, N):
  flag = True
  for j in range(i):
    if P[j] < P[i]:
      flag = False
      break
  
  if flag: s += 1
    
print(s)

Submission status: Time Limit Exceeded

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

cnt = 1

for i in range(len(P)):
    for j in range(0, i):
        if P[i] <= P[j]:
            if i == j+1:
                cnt += 1
            pass
        else:
            break

print(cnt)

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

Submission status: Time Limit Exceeded

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

s = N
ans = 0
for i in range(N):
    if p.index(i) < s:
        ans += 1
        s = p.index(i)
print(ans)

Submission status: Time Limit Exceeded

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

data=[n+1]
for i in range(n):
  res=min(data)
  if res>p[i]:
    data.append(p[i])
print(len(data)-1)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(n):
    for j in range(i):
        if P[i]>P[j]:
            ans-=1
            break
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())

    r = 0
    for i1 in range(n):
        r += min(a[:i1+1]) >= a[i1]

    print(r)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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