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()))
ans = 0
maximum = 0
for p in P:
  if p >= maximum:
    maximum = p
    ans += 1
print(ans)

N = int(input())
P = list(map(int, input().split()))
ans = 0
minimum = 200001
for p in P:
  if p <= minimum:
    minimum = p
    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 = 0

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

print(ans)

N = int(input())
P = list(map(int, 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)


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
mini=10e+7
for i in range(n):
  if(p[i]>mini):
    ans+=1
    mini=p[i]
print(ans)

n=int(input())
p=list(map(int,input().split()))
ans=0
mini=10e+6
for i in range(n):
    if(mini>p[i]):
        ans+=1
        mini=p[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()))

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

print(ans)

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

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

print(ans)

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

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

print(ans)

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 = input()
P_list = input().split()
# N = '5'
# P_list = '4 2 5 1 3'.split()
P_list = [int(i) for i in P_list]
length = len(P_list)
ans = 0 
M = []
for i in range(length):
    print(min(P_list[0:i+1]))
    M.append(min(P_list[0:i+1]))
for i in range(length ):
    if P_list[i]==M[i]:
        ans +=1

print(ans)


N = input()
P_list = input().split()
# N = '5'
# P_list = '4 2 5 1 3'.split()
P_list = [int(i) for i in P_list]
length = int(N)
ans = 0 
M = []
mini =-1
for i in range(length):
    # print(min(P_list[0:i+1]))
    if P_list[i] <mini or mini <0:
        mini = P_list[i]
    if mini == P_list[i]:
        ans +=1


    # if P_list[i]==min(P_list[0:i+1]):
    #     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())
num=list(map(int,input().split()))
don=[]
cnt=0
#don.append(num[0])
for i in num:
	flg=True
	for j in don:
		if i > j:
			flg=False
	if flg:
		#don.append(i)
        cnt+=1
print(cnt)


n=int(input())
num=list(map(int,input().split()))
don=[]
cnt=0
for i in num:
    flg=True
    for j in don:
        if i > j:
            flg=False
    if flg:
        cnt+=1
print(cnt)

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

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

ans = 0
for i in range(n):
    check = p[i]
    ans_ = 0
    for j in range(i):
        if p[j] <= p[i]:
            ans_ += 1 
    
    if ans_ == i - 1:
        ans += 0
        
print(ans)

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

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

ans = 0
for i in range(n):
    p_all = sum(p[:i+1])
    
    if p[i] * (i+1) <= p_all:
        ans += 1
    
print(ans)

n = int(input())
ppp = list(map(int, input().split()))
curr = 10 ** 6
ans = 0
for p in ppp:
    if p < curr:
        ans += 1
        curr = p
print(ans)

Verdicts: Wrong Answer

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):
def main():
    N = int(input())
    P = list(map(int, input().split()))
    min = 0
    count = 0
    for i in range(N):
        x = P[i]
        if x <= min:
            count += 1
            min = x
    print(count)
if __name__ == '__main__':
    main()

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)

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())
lists = list(map(int, input().split()))
count = 1
mins = lists[0]
for i in range(1,N):
	if lists[i] <= mins:
    	count = count + 1
		mins = lists[i]
print(count)

N = int(input())
lists = list(map(int, input().split()))
count = 1
mins = lists[0]
for i in range(1,N):
    if lists[i] <= mins:
        count = count + 1
        mins = lists[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):

class Solution:
    def solve(self, N: int, P: List[int]) -> int:

        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

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

    # solve
    solution = Solution()
    print(solution.solve(N, P))

class Solution:

    def solve(self, N, P) :
        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

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

    # solve
    solution = Solution()
    print(solution.solve(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):
N = int(input())
P = list(map(int, input().split()))
count = 0
minnum = 0
num = 1
while num <= max(P):
        minnum = P.index(min(P))
        del P[minnum+1:]
        count = count + 1
        num = minnum
print(count) 

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

print(count)

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

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

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

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

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

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

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):
import numpy as np
n=int(input())
p=np.array(list(map(int, input().split())))

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

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

cnt = 0
for i,v in enumerate(p):
    if i == 0:
        cnt += 1
        min_ = v
        continue
    if min_ > v:
        min_ = v
        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())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans))

n = int(input())
lst = map(int, input().split())
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans))

n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(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())
numbers = list(map(int,input().split()))

result = 0
for i in range(n):
    a = numbers[i]
    print(a)
    cnt =0
    for j in range(i):
        b = numbers[j]
        print(a,b)
        if b > a:
            cnt += 1
        else:
            break
    if i  == cnt:
        result += 1

print(result)

n = int(input())
numbers = list(map(int,input().split()))
cnt = 0
a = 2*10**5
for i in range(n):
    a = min(numbers[i],a)
    if a >= numbers[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):
import bisect
N = int(input())
P = list(map(int, input().split()))

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

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

count = 0
last_min = P[0]
for i in range(N):
    last_min = min(last_min, P[i])
    if i == 0:
        count += 1
    elif last_min == P[i]:
        count += 1
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()))

ntk = 0
l = []
for i in P:
	l.append(i)
	if i = min(l):
		cnt += 1
print(cnt)

import numpy as np
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if np.all(nl[:i+1] >= l[i]):
    cnt += 1
print(cnt)

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

cnt = 0
mi = P[0]
for i in range(N):
	if P[i] <= mi:
		mi = 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):
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N =I()
P= LI()
#AB = [LI() for _ in range(N)]

#Ap = np.array(A)


count = 1
min_array =[P[0]]
for i in range(1,N):
    if (P[i]<=min_array[i-1]):
        count += 1    
    if P[i-1]>P[i]:
        min_array.append(P[i])
    else:
        min_array.append(P[i-1])

print(min_array)

print(count)
# if ans:
#     print('Yes')
# else:
#     print('No')

import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N =I()
_P= LI()
#AB = [LI() for _ in range(N)]

P = np.array(_P)



def main():
    # count = 1
    # # if (len(P)==1):
    # #     return count
    # min_array =[P[0]]
    
    #     if (P[i]<=min_array[i-1]):
    #         count += 1    
    #     if P[i-1]>P[i]:
    #         min_array.append(P[i])
    #     else:
    #         min_array.append(P[i-1])
    # return count
# print(min_array)
    Q = np.minimum.accumulate(P)
    count = np.count_nonzero(P <= Q)
    return count

print(main())
# if ans:
#     print('Yes')
# else:
#     print('No')

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

def input1():
	return int(input())


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


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


N=input1()
p=input_array()
count=0
for i in p:
	flag=True
	for j in p[:i+1]:
		if i<=j:
			flag=True
		else:
			flag=False
			break
	if flag:
		count+=1
print(count)









def input1():
	return int(input())


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


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


N=input1()
p=input_array()
count=0
min_int=0
for i in range(N):
	num=p[i]
	if i==0:
		min_int=num
		count+=1
	elif num<=min_int:
		min_int=num
		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())
lst = list(map(int, input().split()))

i = 0
mini = n +1
for _ in lst:
    print(_, mini, i)
    if mini > _:
        mini = _
        i += 1
print(i)

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

i = 0
mini = n +1
for _ in lst:
    if mini > _:
        mini = _
        i += 1
print(i)


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):
import sys
read=sys.stdin.buffer.read
N,*P=map(int,read().split())
max_val=0
cnt=0
for p in P:
  max_val=max(max_val,p)
  if max_val == p :
    cnt+=1
print(cnt)



import sys
read=sys.stdin.buffer.read
N,*P=map(int,read().split())
max_val=float('inf')
cnt=0
for p in P:
  max_val=min(max_val,p)
  if max_val == p :
    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())
num_list = map(int, input().split())

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

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

k = 0
for i in range(len(num_list)):
    if i == 0:
        temp_min = num_list[i]
    else:
        temp_min = min(temp_min, num_list[i])
        
    if i != len(num_list)-1:
        if temp_min == num_list[i]:
            k += 1
    else:
        if temp_min == num_list[i]:
            k += 1
    
print(k)

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 = [_ for _ in map(int,input().split())]
res = 0
for x in L:
  if x <= N:
    res += 1
  	N = x 
print(res)
    

N = int(input())
L = [_ for _ in map(int,input().split())]
res = 0
for x in L:
  if x <= N:
    res += 1
    N = x 
print(res)


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):
# -*- coding: utf-8 -*-

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

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

print(c)

# -*- coding: utf-8 -*-

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

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

print(c)

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())
x = list(map(int,input().split()))
count = 1
if n >=2:
  for i in range(n-2):
    a = min(x(range(0,i)))
    if a >=x[i+1]:
      count+=1
    else:
      count+=0
else:
  print(count)
  exit()
  
print(count)

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

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

n = input()
x = list(map(int,input().split()))
count = 0
for i in range(1,n):
  if all(x[j]>x[i]) for for j in range(0,i-1):
    count+=1
print(count)

n = input()
x = list(map(int,input().split()))
count = 0
for i in range(1,n):
  if all(x[j]>x[i] for j in range(0,i-1)):
    count+=1
print(count)

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

n = int(input())
x = list(map(int,input().split()))
count = 1
if n >=2:
  for i in range(n-2):
    a = min(x(range(0,i)))
    if a>=x[i+1]:
      count+=1
    else:
      count+=0
print(count)

n = int(input())
x = list(map(int,input().split()))
count = 1
if n >=2:
  for i in range(n-2):
    a = min(x(range(0,i,1)))
    if a >=x[i+1]:
      count+=1
    else:
      count+=0
else:
  print(count)
  exit()
  
print(count)

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

n = input()
x = list(map(int,input().split()))
count = 0
for i in range(1,n):
  if all(x[j]>x[i]) for j in range(0,i-1):
    count+=1
print(count)

n = int(input())
x = list(map(int,input().split()))
count = 1
m = x[0]

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

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):
x = input().split()
n = int(x[0])
m = x[1:len(x)]
k = 0
for i in range(0,n):
    a = int(m[i])
    for j in range(0,i):
        if int(m[i]) > int(m[j]):
            a = int(m[j])
    if a == int(m[i]):
        k += 1
print(k)

x = input().split()
n = 0
for i in range(1,int(x[0])+1):
    l = 0
    for j in range(1,i+1):
               if int(x[i]) <= int(x[j]):
                    l += 1
    if l == i:
        n += 1
print(n)

x = input().split()
n = 0
for i in range(1,int(x[0])+1):
    l = 0
    for j in range(1,i+1):
               if x[i] <= x[j]:
                l += 1
    if l == i:
        n += 1
print(n)

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

Verdicts: 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())
b=list(map(int,input().split()))
count=1
temp=[b[0]]
for i in range(1,n):  
  if b[i]==min(b[i],temp):
    count=count+1
    temp=b[i]
print(count)

n=int(input())
b=list(map(int,input().split()))
count=1
temp=b[0]
for i in range(1,n):  
  if b[i]==min(b[i],temp):
    count=count+1
    temp=b[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()))

num = P[0]
count = 1

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

print(count)

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

num = P[0]
count = 1

for i in range(1, N):
  if num >= P[i]:
    count += 1
    num = P[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()))
count = 1

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

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

if N > 0:
  min = P[0]
  
for i in range(1, N):
  isbreak = False
  
  if P[i] < min :
    min = P[i]
    continue
    
  for j in range(0,i):
    if (P[i] > P[j]):
      isbreak = True
      break
  if isbreak == False:
    count += 1
    
print(count)

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

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

Verdicts: Wrong Answer

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()))
count=0
MAX=P[0]
for num in P:
    if num<=MAX:
        count+=1
    else:
        MAX=num

print(count)

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)

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
r = p[0]
for i in range(1, n+1):
    s = min(r, p[i-1])
    if (s == p[i-1]):
        count += 1
print(count)

n = int(input())
p = list(map(int, input().split()))
count = 0
s = p[0]
for i in range(1, n+1):
    s = min(s, p[i-1])
    if (s == p[i-1]):
        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):
def resolve():
    N = int(input())
    P = list(map(int, input().split()))

    n = 0
    x = 10 ** 20
    for i in range(N):
        if x >= P[i]:
            x = P[i]
            n += 1
	print(n)
resolve()

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

    n = 0
    x = 10 ** 20
    for i in range(N):
        if x >= P[i]:
            x = P[i]
            n += 1
    print(n)

resolve()

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())
a = list(map(int, input().split()))
ans = 0

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

print(ans)

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

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

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

print(ans)

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

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

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()))
ans = 0
min_p = p[0]
for i in p:
  if i <= min_p:
    cnt += 1
     min_p = i
print(ans)


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

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


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


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


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()))
a = p[0]
ans = 0
for i in range(n):
  if(a<=p[i]):
    ans += 1
    a = p[i]
print(ans)


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

n = int(input())
p = list(map(int,input().split()))
a = p[0]
ans = 0
for i in range(n):
  if(a>=p[i]):
    ans += 1
    a = p[i]
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 = input().split()
counter = 0
for i in range(N):
    k = i+1
    for j in range(k):
        print("i={},j={}".format(i,j))
        if int(P[i]) > int(P[j]):
            break
    if (i == j ):
        counter += 1
print(counter)


N = int(input())
P = input().split()
counter = 0
m = N
for p in P:
    if int(m) >= int(p):
        counter +=1
        m = p
print(counter)

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):
import itertools

N=int(input())
P=[i for i in range(1,N+1) if i%10 != 0]

P_ite=tuple(itertools.combinations_with_replacement(P, 2))
P_ite_len=len(P_ite)

ans=0
for i in range(P_ite_len):
    a=str(P_ite[i][0])
    b=str(P_ite[i][1])
    if a[0] == b[-1] and a[-1] == b[0]:
        if a == b:
            ans+=1
        else:
            ans+=2
print(ans)

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

tmp=P[0]
ans=1

for i in range(1,N):
    if tmp >= P[i]:
        ans+=1
        tmp=min(tmp, P[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(" ")))
m = P[0]
c = 0
for i in range(1, N):
  if P[i] < m:
    c += 1
    m = P[i]
print(c)

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

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())) 
correct_answer_count = 0
for i in range(1, N + 1):
    bat_answer_count = 0
    for j in range(1, i+1):
        if not (A[i] <= A[j]):
            bat_answer_count += 1

    if bat_answer_count == 0:
        correct_answer_count += 1

print(correct_answer_count)    


fast_list = list(map(int, input().split())) 
correct_answer_count = 0
bat_answer_count = 0
for i in range(1, fast_list[0] + 1):
    for j in range(1, i+1):
        if not (fast_list[1][i] <= fast_list[1][j]):
            bat_answer_count += 1

    if bat_answer_count == 0:
        correct_answer_count += 1

print(correct_answer_count)    
            
            

N = int(input())
A = list(map(int, input().split())) 
correct_answer_count = 0
for i in range(1, N + 1):
    bat_answer_count = 0
    for j in range(1, i+1):
        if len(A) < j:
            continue
        if not (A[i] <= A[j]):
            bat_answer_count += 1

    if bat_answer_count == 0:
        correct_answer_count += 1

print(correct_answer_count)    

fast_list = list(map(int, input().split())) 
correct_answer_count = 0
for i in range(1, fast_list[0] + 1):
    bat_answer_count = 0
    for j in range(1, i+1):
        if not (fast_list[1][i] <= fast_list[1][j]):
            bat_answer_count += 1

if bat_answer_count == 0:
    correct_answer_count += 1

print(correct_answer_count)    


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

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):
# -*- coding: utf-8 -*-
"""
Created on Wed Mar  4 17:57:43 2020

@author: Kanaru Sato
"""

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

Max = 0
count = 1

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

print(count)

# -*- coding: utf-8 -*-
"""
Created on Wed Mar  4 17:57:43 2020

@author: Kanaru Sato
"""

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

Min = P[0]
count = 1

for i in range(1,N):
    if Min >= P[i]:
        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=int(input())
Pn=[]
P=input().split()
for p in P:
    Pn.append(int(p))

count=1

for i in range(1,len (Pn)):
    targetArr=Pn[:i]
    if Pn[i] >= max(targetArr):
        count+=1
print(count)


N=int(input())
P=input().split()
Pn=[]
Pn.append(int(P[0]))

count=1
nowmin=Pn[0]

for i in range(1,len(P)):
    if int(P[i])<nowmin:
        count+=1
        nowmin = int(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 = int(input())
p = [int(i) for i in input().split()]

t = p[0]
ans = 0
for i in range(n):
    if t >= p[i]:
        ans += 1
    else:
        t = p[i]
        
print(ans)

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

t = p[0]
ans = 0
for i in range(n):
    if t >= p[i]:
        ans += 1
        t = p[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()))


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

n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(n):
  for j in range(i):
    if p[i] > p[j]:
      break
  else:
    count+
    continue
print(count)
    

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

count = 0
temp_min = p[0]
for i in range(n):
  if temp_min >= p[i]:
        count+=1
        temp_min = p[i]
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):
list=list(map(int, input().split()))
count=0
m=list[0]
for i in list:
    a=i
    if m >= a:
        count+=1
    m = a
print(count)

N = int(input())
list=list(input().split() for j in range(N))
count=0
m=list[0]
for i in list:
    a=i
    if m >= a:
        count+=1
    m = a
print(count)

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

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

mins=[0]*n
mins[0]=p[0]
for i in range(1,n):
    mins[i] = min(mins[i-1], p[i])
ans=0
for i in range(0, n):
    if p[i] <= mins[i]:
        print('p[',i,']=',p[i])
        ans+=1

print(ans)

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

mins=[0]*n
mins[0]=p[0]
for i in range(1,n):
    mins[i] = min(mins[i-1], p[i])
ans=0
for i in range(0, n):
    if p[i] <= mins[i]:
        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()))
M=0
c=0
for i in range(N):
  if M<P[i]:
    M=P[i]
    c+=1
print(c)
    

N=int(input())
P=list(map(int,input().split()))
M=N
c=0
for i in range(N):
  if M>=P[i]:
    M=P[i]
    c+=1
print(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().rstrip())
p=[int(i) for i in input().split()]
a=1
m=p[0]
for i in range(1,n):
    if p[i]<=m:
        a+=1
        print(a)
    m=min(m,p[i])

        
print(a)

n=int(input().rstrip())
p=[int(i) for i in input().split()]
a=1
m=p[0]
for i in range(1,n):
    if p[i]<=m: 
      a+=1
    m=min(m,p[i])
        
print(a)

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
for i in range(n):
    for j in range(i+1):
        if (p[i] <= p[j]):
            ans += 1
            break
print(ans)


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

ans = 0
pmax = p[0]
for i in range(n):
    if (p[i] <= pmax):
        ans += 1
        pmax = p[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())
l=list(map(int,input().split()))
ans=0
tmp=0
for i in range(1,n):
    if tmp>=l[i]:
      tmp=l[i]
      ans+=1
print(ans)


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


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

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


Verdicts: Wrong Answer

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

cnt = 1
after = [P[i-1] for i in range(1, N)]
for a in after:
    if a < P[i]:
        break
else:
    cnt += 1
print(cnt)

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = 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):
N = int(input())
P = list(map(int, input().split()))
# count = 0

#     for n in range(i + 1):
#         if P[n] < P[i]:
#             break

#             count += 1
# print(count)


N = int(input())
P = list(map(int, input().split()))
MIN = list()
count = 0
MIN.append(P[0])
for i in range(1, N):
    MIN.append(min(MIN[i - 1], P[i]))
for i in range(0, N):
    if P[i] <= MIN[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):
#!/usr/bin/env python3

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

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

print(count)


#!/usr/bin/env python3

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

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

print(count)


#!/usr/bin/env python3

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

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

cnt = 1
min_p = p[0]

if n == 1:
    print(n)
else:
    for i in range(1, n):
        if p[i] > min_p:
            min_p = p[i]
            cnt += 1
    print(cnt)


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

cnt = 1
min_p = p[0]

if n == 1:
    print(n)
else:
    for i in range(1, n):
        if p[i] < min_p:
            min_p = p[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()))
value = p[0]
ans = 1

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

print(ans)

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

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

print(ans)

n = int(input())
p = list(map(int,input().split()))
value = 1000000000
ans = 0

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

print(ans)

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):
nums = map(int, input().split())
count = 0
min_sofar = float('inf')
for num in nums:
  if num <= min_sofar:
    count += 1
    min_sofar = num
print(count)

input()
nums = map(int, input().split())
count = 0
min_sofar = float('inf')
for num in nums:
  if num <= min_sofar:
    count += 1
    min_sofar = num
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())
list_P = [int(x) for x in input().split()]

ans = 1

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

print(ans)


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

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = 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 = int(input())
p = list(map(int, input().split()))

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

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

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

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

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())
h=list(map(int,input().split()))
c = 0
a = h[0]
for i in range(0,N):
    s = 0
    if h[i] > a:
        a = h[i]
        break
    for j in range(0,i):
        if h[j] >= h[i]:
            s += 1
    if s == i:
        c += 1
print(c)

N = int(input())
h=list(map(int,input().split()))
c = 0
a = h[0]
for i in range(0,N):
    if a > h[i]:
        a = h[i]
    if a >= h[i]:
        c += 1
print(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())
li = list(map(int,input().split()))
icount = 0
for i in range(n):
    if li[i] == min(li[0:i]):
        icount += 1:
print(icount)

n = int(input())
p = list(map(int,input().split()))
count = 1
min_p = p[0]
for i in range(n):
    if min_p > p[i]:
        count += 1
        min_p = p[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 = map(int, input().split())

ret = 0
currmin = P[0]
for i in range(N):
    if P[i] <= currmin:
        currmin = P[i]
        ret += 1

print(ret)


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

ret = 0
currmin = P[0]
for i in range(N):
    if P[i] <= currmin:
        currmin = P[i]
        ret += 1

print(ret)

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(lambda p : int(p), input().split(" ")))
left_min = P[0]
cnt = 0
for i in range(P):
  if left_min >= P[i]:
    cnt += 1
    left_min = P[i]
print(cnt)

N = int(input())
P = list(map(lambda p : int(p), input().split(" ")))
left_min = P[0]
cnt = 0
for i in range(len(P)):
  if left_min >= P[i]:
    cnt += 1
    left_min = P[i]
print(cnt)

Verdicts: Runtime Error

Accepted