TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

c = [True for i in range(n)]
for i in range(1,n):
  pmod = sorted(p[0:i])
  if p[i]>pmod[-1]:
      c[i] = False
print(sum(c))

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

c = [True for i in range(n)]
target = p[0]
for i in range(1,n):
  if p[i]>target:
      c[i] = False
  else:
    target = p[i]
print(sum(c))

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
p = [int(e) for e in input().split(" ")]
low = p[0]
c = 0
for i in range(N):
    print(p[i], low)
    if(p[i] <= low):
        c += 1
        low = p[i]
        print(">increment")
print(c)

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

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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
p = 0
minnum = 200001
counter = 0

for i in range(N):
  p = int(input())
  if p < minnum:
    counter += 1
    minnum = p

print(counter)
  

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

counter = 0
min_num = 1000000

for i in range(N):
    if lst_p[i] <= min_num:
        counter += 1
        min_num = lst_p[i]
    else:
        continue
print(counter)

Verdicts: Runtime Error

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

Submission attempts (in order):
n=int(input())
l=list(map(int, input().split()))
ans=0
min=2*100000
for i in range(n):
    num_now=l[i]
    if num_now<min:
        ans+=1
print(ans)


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]
    num_now=l[i]
    list_now.sort()
    if num_now==list_now[0]:
        ans+=1
print(ans)

n=int(input())
l=list(map(int, input().split()))
ans=0
min=2*100000
for i in range(n):
    num_now=l[i]
    if num_now<=min:
        ans+=1
        min=num_now
print(ans)


Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
N = int(input())
P = list(map(int, input().split()))
ret = N
for i in range(len(P)):
  if min(P[:i+1]) != P[i]:
    ret = i + 1
  	break
print(ret)

N = int(input())
if N <= 10:
    print(1)
else:
    ret = 0
    #diff num
    for i in range(1,10):
      for j in range(i+1,10):
        a = 0
        b = 0
        for k in range(1, 6):
          if i * 10 ** k + j < N:
            a += 10 ** (k - 1)
        for k in range(1, 6):
          if j * 10 ** k + i < N:
            b += 10 ** (k - 1)
            ret += a * b * 2
         #same num
    for i in range(1,10):
      c = 1
      for k in range(1,6):
        if i * 10 ** k + i < N:
           c += 10 ** (k - 1)
      ret += c * c
    print(ret)

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

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

for i in range(len(P)):
  if min(P[:i+1]) != P[i]:
    return i
  return len(P)

N = int(input())
P = list(map(int, input().split()))
ret = 0
minval = 0
for i in range(len(P)):
  if i == 0:
    minval = P[i]
  if minval >= P[i]:
    ret += 1
    minval = P[i]
print(ret)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

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

Submission attempts (in order):
n = int(input())
p = list(map(int,input().split()))
min = p[0]
c = 0
 
for smp in p:
  if(min >= smp):
    min = smp
    print(min)
    c += 1
 
print(c)

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)

n = int(input())
p = list(map(int,input().split()))
min = p[0]
c = 0
 
for smp in p:
  if(min >= smp):
    min = smp
    c += 1
 
print(c)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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)

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)

import numpy as np

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

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


Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

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

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

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

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

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

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):


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

count = 1

for idx, i in enumerate(seq[1:]):
  if i > seq[idx+2]:
   continue
  else:
    count += 1
print(count)




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

count = 1

for idx, i in enumerate(seq[1:]):
  if i > idx+2:
   continue
  else:
    count += 1
print(count)

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

count = 1

current_min = seq[0]

for idx, i in enumerate(seq[1:]):
  if i < current_min:
    current_min = i
    count += 1
print(count)

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
import sys
from operator import itemgetter
import collections

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

def main():
    input = sys.stdin.readline
    n = int(input())
    p = map(int, input().split())
    print(r(n,p))

    
if __name__ == '__main__':
    main()


import sys
from operator import itemgetter
import collections

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

def main():
    input = sys.stdin.readline
    n = int(input())
    p = list(map(int, input().split()))
    print(r(n,p))

    
if __name__ == '__main__':
    main()


Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

q = p[0]
p = p[1:]

m = 1

if n > 1:
    for pi in p:
        if q > pi:
            print(pi)
            m += 1
            q = pi

print(m)


n = int(input())
p = map(int, input().split())
m = 1

if n > 1:
    for i, pi in enumerate(p):
        if pi <= i:
            continue
        elif all([pj >= pi for pj in p[:i]]):
            m += 1
        else:
            continue

print(m)


n = int(input())
p = map(int, input().split())
m = 1

if len(pi) > 1:
    for i, pi in enumerate(p):
        if pi <= i:
            continue
        elif all([pj >= pi for pj in p[:i]]):
            m += 1
        else:
            continue

print(m)


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

q = p[0]
p = p[1:]

m = 1

if n > 1:
    for pi in p:
        if q > pi:
            m += 1
            q = pi

print(m)


Verdicts: Wrong Answer

Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
numbers = list(map(int, input().split()))
c = 0

for i in numbers[::-1]:
    for j in numbers[i-1::-1]:
        if  i <= j :
            continue
        else:
            break
    else:
        c += 1

print(c)


n = int(input())
number = list(map(int, input().split()))
cnt = 0
min_num = number[0]
for i in range(n):
  if min_num >= number[i]:
    cnt += 1
    min_num = number[i]
  else:
    continue
print(cnt)

Verdicts: Wrong Answer

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

Submission attempts (in order):
input()
nums = map(int, input().split())

prev_min = 10 ** 9
result = 0
for n in nums:
  if prev_min < n:
    break
  result += 1
  prev_min = min(prev_min, n)

print(result)

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

result_sum = 0
prev_min = 10  ** 9
for i in range(iterate):
  if p[i] <= prev_min:
    	result_sum += 1
  prev_min = min(prev_min, p[i])

print(result_sum)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())

List = list(map,input().split())

m = 1
cnt = 0

for i in range(N):
  a = List[i]
  if a <= m :
    cnt += 1
    m = a
    
print(int(cnt))

N = int(input())

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

m = 10 ** 10
cnt = 0

for i in range(N):
  a = List[i]
  if a <= m :
    cnt += 1
    m = a
    
print(int(cnt))


Verdicts: Runtime Error

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

Submission attempts (in order):
n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if min_list>=x:
    ans+=1
    premin=x
print(ans)


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

n=int(input())
lst=list(map(int,input().split()))
premin=[lst[0]]
ans=0
for x in lst:
  if min_list>=x:
    ans+=1
    premin=x
print(ans)

n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

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

Submission attempts (in order):
N=int(input())
p=list(map(int, input().split()))
cnt=0
min=p[0]
for i in range(N):
	if p[i]<=min:
		min=p[i]
        cnt+=1
        
print(cnt)

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

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

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
p = [int(s) for s in input().split()]
count = 0
m = p[0]
for a in range(n):
     i = p[a]
     if M>=i:
         count+=1
         m = i
        
print(count)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
a= int(input())
b= input().split()
compare=b[0]
c=0

for i in range(a):
    if (compare<=b[i]):
        compare=b[i]
        c=c+1
        
print(c)

N= int (input ())
Per= input().split()
cnt=0
compare = int (Per[0])
for i in range (len(Per)):
    if (compare >= int (Per[i])):
        compare= int(Per[i])
        cnt+=1
    

print (cnt)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
P = list(map(int,input().split()))

s = 0
t = 1
for i in range(0,N):
    for j in range(0,i):
        if P[j] <= P[i]:
            s = s + 1
    if s != i:
        t = t + 1
        s = 0
    else:
        s = 0
print(t) 

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

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
P = list(map(int, input().split()))

cnt=0

import numpy as np

P=np.array(P)

max_val=P[0]

cnt=1

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

    if max_val > P[i]:
        cnt+=1

print(cnt)

N = int(input())

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

cnt=0

import numpy as np

P=np.array(P)

max_val=P[0]

cnt=1

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

    if max_val > P[i]:
        cnt+=1

print(cnt)

Verdicts: Runtime Error

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

Submission attempts (in order):
i = int(input())
j = [int(x) for x in input().split()]

e = []
cnt = 0
for x in j:
    e.append(x)
    if max(e) <= x:
        cnt += 1
print(cnt)

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

m = j[0]
count = 0
for x in range(i):
    if m >= j[x]:
        count += 1
        m = j[x]
print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
a=int(input())
lis=list(map(int,input().split()))
min=0
ans=0
for i in lis:
  if min<=i:
    ans+=1
    min=i
print(ans)

a=int(input())
lis=list(map(int,input().split()))
min=float('inf')
ans=0
for i in lis:
  if min>=i:
    ans+=1
    min=i
print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
#include<stdio.h>

int con(int a,int b){
    if(a>b){
       return b; 
    }else{
        return a;
    }
}

int main(void){
    int n;
    int count=0;
    int a[200000];
    int min=__INT_MAX__;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        min=con(min,a[i]);
        if(min==a[i]){
            count++;
        }
    }

    printf("%d",count);
}

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



def main():
    import sys
    input = sys.stdin.readline 
    n = int(input())
    p = list(map(int, input().split()))

    mi = 1000000000
    cnt = 0
    for i in range(n):
        if p[i] <= mi:
            cnt += 1
        if mi > p[i]:
            mi = p[i]
    print(cnt)

main()

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
l = list(map(int, input().split()))
count = 0

num = l[0]

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

print(count)

n = int(input())
l = list(map(int, input().split()))
count = 0

num = l[0]
ans = 1

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

print(count)

n = int(input())
l = list(map(int, input().split()))
count = 0

num = l[0]
count = 1

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

print(count)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N=int(input())
L=list(map(int,input().split()))
ans=0
prev=-1
for l in L:
  if l<prev:
    ans+=1
    prev=l
  else:
    continue
print(ans)

N=int(input())
L=list(map(int,input().split()))
ans=0
prev=float('inf')
for l in L:
  if l<prev:
    ans+=1
    prev=l
  else:
    continue
print(ans)


Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input()

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
P = list(map(int, input().split()))

ans = 0

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

print(ans)

N = int(input())
P = list(map(int,input().split()))
m = float("inf")
count = 0

for i in P:
    if m > i:
        m = i
    if m == i:
        count += 1
print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
p = list(map(int,input().split()))
count = 0

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

n = int(input())
p = list(map(int,input().split()))
count = 0
min = p[0]

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n, *p = map( int, open(0).read().split())

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


n, *p = map( int, open(0).read().split())
 
cnt = 0
min_val = 1000000
for i in range( len( p )):
  if p[i] < min_val:
    cnt += 1
    min_val = p[i]

print( cnt )

Verdicts: Runtime Error

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

Submission attempts (in order):
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]):
    count += 1
print(count)    

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


Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
L = list(map(int, input().split()))

tmp = -1
count = 0
for i in range(N):
    if tmp <= L[i]:
        count += 1
    tmp = max(tmp, L[i])
        
print(count)

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

tmp = 10 ** 10
count = 0
for i in range(N):
    if tmp >= L[i]:
        count += 1
    tmp = min(tmp, L[i])
        
print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input)
P = [int(x) for x in input().split()]
pmin = max(P)
cnt = 0
for p in P:
  if p <= pmin:
    cnt += 1
    pmin = p
print(cnt)

N = int(input())
P = [int(x) for x in input().split()]
pmin = max(P)
cnt = 0
for p in P:
  if p <= pmin:
    cnt += 1
    pmin = p
print(cnt)


Verdicts: Runtime Error

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

Submission attempts (in order):
N=int(input())
S=list(map(int, input().split()))

SS=[]
n=0
ans=0
while n<=N:
  SS.append(S[n])
  if min(SS)>int(SS[n]):
    n+=1
    ans+=1
print(ans)

N=int(input())
S=list(map(int, input().split()))
Min=2*(10**5)
ans=0
for i in S:
  if Min>=i:
    Min=i
    ans+=1
    
print(ans)

Verdicts: Time Limit Exceeded

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

Submission attempts (in order):
n = int(input())
numbers = list(map(int, input().split()))
count = 1
past = 0
for i in numbers:
    if past > i:
        count += 1
        past = i
print(count)


n = int(input())
numbers = list(map(int, input().split()))
count = 0
past = 10 ** 6
for i in numbers:
    if past > i:
        count += 1
        past = i
print(count)


Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
b=[]
mx=0
cnt=0
for i in a:
  mx=max(mx,i)
  if mx<=i:
    cnt+=1
print(cnt)

n=int(input())
a=list(map(int,input().split()))
b=[]
mx=10**10
cnt=0
for i in a:
  mx=min(mx,i)
  if mx>=i:
    cnt+=1
print(cnt)


Verdicts: Wrong Answer

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

Submission attempts (in order):
#!/usr/bin/env python3

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

    mini = 2*10**5
    cnt = 0
    for _ in P:
        if _ >= mini:
            mini = _
            cnt += 1
        else:
            continue
    print(cnt)


main()

#!/usr/bin/env python3

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

    mini = 10**6
    cnt = 0
    for _ in P:
        if _ >= mini:
            mini = _
            cnt += 1
        else:
            continue
    print(cnt)


main()

#!/usr/bin/env python3

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

    mini = 10**6
    cnt = 0
    for _ in P:
        if _ < mini:
            mini = _
            cnt += 1
        else:
            continue
    print(cnt)


main()

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
n = int(input())
p = [int(i) for i in input().split()]
count = 0
min_value = p[0]
for i in enumerate(p):
    if i <= min_value:
        count += 1
        min_value = i
print(count)

n = int(input())
p = [int(i) for i in input().split()]
count = 0
min_value = p[0]
for i in p:
    if i <= min_value:
        count += 1
        min_value = i
print(count)

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
m =list(map(int,input().split()))
ans = 0
if len(m) ==1:
    print(1)
else:
    for i in range(len(m)-1):
        s = m[0:i+1]
        print(max(s))
        if m[i] == min(s):
            ans+=1

    print(ans)


n = int(input())
m =list(map(int,input().split()))
ans = 0
currentmin = 1e9

for i in range(len(m)):
    currentmin = min(currentmin,m[i])
    #print(s)
    #print(max(s))
    if m[i] == currentmin:
        ans+=1
        
print(ans)


Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
P=list(map(int,input().split()))
ans=1
for i in range(1,N):
    if max(P[:i])==max(P):
        break
    if min(P[:i])>P[i]:
        ans+=1
print(ans)

N=int(input())
P=list(map(int,input().split()))
x=N+1
cnt=0

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
li = list(map(int,input().split()))
count=1
li2=[]
for i in range(1,n):
  li2=li[0,i-1]
  if(max(li2)>=li[i]):
    count+=1
print(count)


# coding: utf-8
# Your code here!
n=int(input())
li = list(map(int,input().split()))
count=1
li2=[]
if(len(li)!=1):
    for i in range(1,n):
        if(i==1):
            if(li[0]>=li[1]):
                count+=1
            continue
        li2=li[0,i-1]
        if(max(li2)>=li[i]):
            count+=1
print(count)


n=int(input())
li = list(map(int,input().split()))
count=1
m=n
for i in range(1,n):
    m=min(m,li[i-1])
    if(m==1):
        break
    if(m>=li[i]):
        count+=1
print(count)


Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
N = int(input())
p = list(map(int, input().split()))

cnt = 0
max_p = p[0]
for i in range(1, N):
    if max_p <= p[i]:
        cnt += 1
    max_p = max(max_p, p[i])
print(cnt)

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]:
        print(i, min_p)
        cnt += 1
    min_p = min(min_p, p[i])
print(cnt)

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)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
# cook your dish here
n=int(input())
a=list(map(int,input().split()))
st=[]
for i in range(n):
    if i==0:
        st.append(a[i])
    else:
        if st[-1]>=a[i]:
            ans+=1
        else:
            st.append(a[i])

# cook your dish here
n=int(input())
a=list(map(int,input().split()))
st=[]
ans=0
for i in range(n):
    if i==0:
        st.append(a[i])
        ans+=1
    else:
        if st[-1]>=a[i]:
            ans+=1
            st.append(a[i])
print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
N,j = map(int,input().split())
P = list(map(int,input().split()))
count = 0
i = 0
while i < N:
  if P[i] <= P[j]:
    count += 1
print(count)

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

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
P = [int(input()) for _ in range(n)]
c = 0 
for i in range(n):
  for j in range(0,i):
    if P[i] ＞ P[j]:
      break
  else:
    c += 1
print(c)

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

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
"""
can do it by subproblems. for a given i, the only information you need from the previous values
is the min value of previous values.
the first i=0 is guaranteed to satisfy the constraint. (counting from zero).
"""
import sys


def count_low_elements(N, P):
    count = 0
    min_so_far = sys.maxsize
    for val in P:
        if val <= min_so_far:
            count += 1
            min_so_far = val
    return count


if __name__ == "__main__":
    test1 = \
"""5
4 2 5 1 3"""
    test2 = \
"""4
4 3 2 1"""
    test3 = \
"""6
1 2 3 4 5 6"""
    test4 = \
"""8
5 7 4 2 6 8 1 3"""
    test5 = \
"""1
1"""
    test = test5
    # N, P_string = test.split("\n")
    # P = list(map(int, P_string.split()))
    N = int(input())
    P = list(map(int, input().split()))
    print(count_low_elements(N, P))
`

"""
can do it by subproblems. for a given i, the only information you need from the previous values
is the min value of previous values.
the first i=0 is guaranteed to satisfy the constraint. (counting from zero).
"""
import sys


def count_low_elements(N, P):
    count = 0
    min_so_far = sys.maxsize
    for val in P:
        if val <= min_so_far:
            count += 1
            min_so_far = val
    return count


if __name__ == "__main__":
    test1 = \
"""5
4 2 5 1 3"""
    test2 = \
"""4
4 3 2 1"""
    test3 = \
"""6
1 2 3 4 5 6"""
    test4 = \
"""8
5 7 4 2 6 8 1 3"""
    test5 = \
"""1
1"""
    test = test5
    # N, P_string = test.split("\n")
    # P = list(map(int, P_string.split()))
    N = int(input())
    P = list(map(int, input().split()))
    print(count_low_elements(N, P))

Verdicts: Runtime Error

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

Submission attempts (in order):
def lowElements(n:int , array:list):
    count = 1
    for k in range(1,len(array)):
        if min(array[:k]) >= array[k]:
            count = count + 1
    return count

n = int(input())
array = [int(n) for n in input().split()]
count,m = 1,array[0]
for k in range(1,n):
  if array[k] < m:
    m = array[k]
    count = count + 1
print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        print(i)
    else:
        min = int(arr[i])

print(cnt)

N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
    else:
        min = int(arr[i])

print(cnt)

N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        min = int(arr[i])
print(cnt)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

p_f = p[0]
c = 0

for i in p:
    if p_f >= 1:
        c +=1
        p_f = i

print(c)

n = int(input())
p = [int(i) for i in input().split()]
x = p[0]
ans = 0
for i in p:
    if x >= i:
        ans += 1
        x = i
print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
min=0
ans=0
for i z in enumerate:
  if i==0:continue
  if min>=z:
    ans+=1
  min=min(min,z)
print(ans)

n=int(input())
a=list(map(int,input().split()))
min_a=0
ans=0
for i,z in enumerate:
  if i==0:continue
  if min_a>=z:
    ans+=1
  min_a=min(min_a,z)
print(ans)


#C
n = int(input())
p = list(map(int, input().split()))
n = p[0]
ans = 1
for i, z in enumerate(p):
    if i == 0:
        continue
    if z <= n:
        ans += 1
    n = min(n, z)
print(ans)

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
N = int(input())
num = list(map(int,input().split()))
ans = 1
min = num[0]

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

print(ans)
    

N = int(input())
num = list(map(int,input().split()))
ans = 1
min = num[0]

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

print(ans)
           

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
P = list(map(int,input().split()))

minp = P[0]
ans = 0

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

print(ans)



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

minp = P[0]
ans = 0

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

print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
a = int(input())
k = list(map(int, input().split()))

count = 1

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

print(count)


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

count = 0
min =9999999

for i in range(1,len(k)):
  if min > k[i]:
    min= k[i]
    count += 1

print(count)

               


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

count = 0
min =99999999

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

print(count)

               
               


Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if x == 1:
        break
    if min_v>=x:
        min_v=x
    else:
        ans+=1
print(ans)

n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if x == 1
    	ans+=1
        break
    if min_v>=x:
        min_v=x
    else:
        ans+=1
print(ans)

n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if min_v>x:
        min_v=x
        ans+=1
print(ans)

Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
N = int(input())
P = list(map(int, input().split()))

count = 0
m = N
for p in reversed(P):
  if p <= m:
    count += 1
    m = p
print(count)

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

count = 0
m = N
for p in reversed(P):
  m = min(m, p)
  if p <= m:
    count += 1
print(count)

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

count = 0
m = N
for p in P:
  m = min(m, p)
  if p <= m:
    count += 1
print(count)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
L = list(map(int, input().split()))
 

F = 0


A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  
F = 0

A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

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

F = 0


A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      continue
      F = 1
  if(F == 1):
    A += 1

print(A+1)

N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  

F = 0


A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)


F = 0


A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

N = int(input())

L = []
for i in range(N):
  P = int(input())
  L.append(P)

F = 0

for i in range(1, N):
  P = L[i]
  for j in range(0, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
      
  if F = 1:
    A += 1
    
print(A)
    
      


      

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
min = N + 1
AC = 0
for i in range(N):
  if min < A[i]:
    min = A[i]
    AC += 1
print(AC)

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

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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
import numpy as np

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

history = []
count = 0

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

print(count)

import numpy as np

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

history = []
count = 0

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

print(count)

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

history = []
count = 0

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

print(count)

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

history = []
count = 0

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

print(count)

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

num_min = num_1[0]
count = 1

for i in range(1,num_0):
  if num_1[i] <= num_min:
    count = count + 1
    num_min = num_1[i]
    
print(count)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))

mn = p[0]
cnt = 0
for i in range(n):
    if p[i] <= mn:
        cnt += 1
    mn = max(mn, p[i])

print(cnt)

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

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

print(cnt)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
P = list(map(int, input().split()))

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


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

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
p = list(map(int, input().split()))
count = 0
tmp = p[0]

for i in range(len(p)):
    target = p[i]
    flag = True
    if tmp < target:
        tmp = target
        continue
    for j in range(i):
        ccount += 1
        if p[i] > p[j]:
            flag = False
            break
    if flag:
        count += 1

print(count)

n = int(input())
p = list(map(int, input().split()))
ans = 0
min = p[0]

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

print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
list = [int(i) for i in input().split()]

ans = 0
min = 0

for j in rainge(N):
    if (min  >= list[j]):
        abs += 1
        min = list[j]
    else:
        continue

print(ans)


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

ans = 0
min = list[0]

for j in range(N):
    if (min  >= list[j]):
        ans += 1
        min = list[j]
    else:
        continue

print(ans)


Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
P_list = list(map(int, input().split()))

count = 1
temp = P_list[0]

for j in range(1, N):
    if P_list[j] == min(P_list[j], temp):
        count += 1
        temp = P_list[j]
        print('j:',j,' temp:',temp)

print(count)

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

count = 1
temp = P_list[0]

for j in range(1, N):
    if P_list[j] == min(P_list[j], temp):
        count += 1
        temp = P_list[j]

print(count)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
P = list(map(int, input().split()))
ans = 0
min_num = P[0]
for n in P:
    if n < min_num:
        min_num = n
        ans += 1
print(ans)

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


Verdicts: Wrong Answer

Accepted