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


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


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
max_val = 0

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

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

ans = 1
min_val = p[0]

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

count = 1
min = List[0]


for i in List[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)


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

count = 1
min = p[0]


for i in p[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)


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

count = 1
min_num = p[0]


for i in p[1:]:
    if i < min_num:
        min_num = 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()))
count = 1
min_p = p[1]

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

print(count)

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

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

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

for i in range(1, n):
    for j in range(n):
        if p[i] > p[j]:
            count -= 1
            break
            
print(count)

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

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 = 1
for i in range(1, N):
    flg = True
    for j in range(i):
        print(P[i], P[j])
        if P[j] < P[i]:
            flg = False
            break
    if flg:
        ans += 1

print(ans)


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

# N = 5
# P = [4, 2, 5, 1, 3]

ans = 0
min = 2 * 10**5
for i in range(0, N):
    
    if min > P[i]:
        min = P[i]
    if P[i] <= min:
        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())
Plist = list(map(int, input().split()))
now = Plist[0]
ans = 0
for p in Plist:
    if p <= now:
        ans += 1
    else:
        break
    now = p
print(ans)


N = int(input())
Plist = list(map(int, input().split()))
ans = 0
M = Plist[0]
for i in range(N):
    M = min(M, Plist[i])
    if Plist[i] == M:
        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):
import numpy
n=int(input())
plist=list(map(int,input().split()))
ans=0

while plist:
  min_index = numpy.argmin(plist)
  if min_index==0:
    ans+=1
    plist=[]
  else:
    ans+=1
    plist=plist[:min_index-1]
print(ans)

import numpy
n=int(input())
plist=list(map(int,input().split()))
ans=0

while plist:
  min_index = numpy.argmin(plist)
  if min_index==0:
    ans+=1
    plist=[]
  else:
    ans+=1
    plist=plist[:min_index]
  print(ans)
print(ans)

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

while plist:
  max_index = plist.index(max_value)
  ans+=max_index+1
  plist=plist-plist[0:max_index]
print(ans)


import numpy
n=int(input())
plist=list(map(int,input().split()))
ans=0

while plist:
  max_index = numpy.argmax(plist)
  ans+=max_index+1
  if max_index==n-1:
    plist=[]
  else:
    plist=plist[max_index+1:]
print(ans)

n=int(input())
P=list(map(int,input().split()))
mn=2*10**5+1
cnt=0

for item in P:
  if mn>item:
    cnt+=1
    mn=item
print(cnt)

Verdicts: Wrong Answer

Wrong Answer

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

n = int(input())
p = np.array(input().split(), dtype = int)

num = 0
las = 0

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

print(num)


import numpy as np

n = int(input())
p = np.array(input().split(), dtype = int)

num = 0
las = 0

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

print(num)


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

mini = 10**9
ans =0 

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

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

mini = 10**9
ans =0 

for i in range(n):
  if p[i] <= mini:
    mini = p[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()))
Pmax=P[0]
result=0
for i in range(N):
  if P[i]<=Pmax:
    result+=1
  else:
    Pmax=P[i]
print(result)


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


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 numpy as np
N=int(input())
P=np.array(list(map(int, input().split())))



mini=1
count=1
index_min=P.argmin()
while P[0]>mini:
  if P==P.sort()[::-1]:
    count+=P.shape[0]
    break
  P=P[:index_min]
  mini=min(P)
  index_min=P.argmin()
  count+=1

print(count)



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



mini=1
count=1
index_min=P.index(mini)
for i in range(N):
  P=P[:index_min+1]
  mini=min(P)
  index_min=P.index(mini)
  count+=1
  if mini==P[0]:
    break
  

print(count)



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



mini=1
count=1
index_min=P.argmin()
while P[0]>mini:
  if P==np.sort(a)[::-1]:
    count+=P.shape[0]
    break
  P=P[:index_min]
  mini=min(P)
  index_min=P.argmin()
  count+=1

print(count)



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

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

print(count)

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

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

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

print(ans)

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

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

cnt = 1
m = lst[0]

for i in lst:
  if i <= m:
    cnt +=1
    m = i
print(cnt)

N = input()
lis = input().split(" ")
cnt = 1
for i in range(int(N+1)):
    for j in range(i-1,-1,-1):
        if int(lis[i])>int(lis[j]):
            break
        else:
            cnt +=1
        break
print(cnt)

N = input()
lis = input().split(" ")
cnt = 0
for i in range(int(N)):
  for j in range(int(N),-1,-1)
  if lis[i]>lis[j]
    cnt += 1
    break
print(cnt)


N = input()
lis = input().split(" ")
cnt = 0
for i in range(int(N)):
  for j in range(i,-1,-1):
      if int(lis[i])>int(lis[j]):
        cnt += 1
        break
print(cnt)

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

Verdicts: Wrong Answer

Runtime Error

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

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

n = int(input())
pn = list(map(int,input().split()))
ans = 1
 
for i in range(1,n):
  if pn[i] <= pn[i-1]:
    ans += 1
  else:
    pn[i] = pn[i-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()))
miss = 0
for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > max(s):
        miss += 1
        continue
 
    
    #for j in range(i):
    #    if p[i] > s[j]:
    #        miss += 1
    #        break

print(n-miss)

n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > max:
        max = p[i]
        miss += 1
        continue

print(n-miss)

n = int(input())
p = list(map(int,input().split()))
miss = 0
for i in range(n):
    s = p[0:i]
    s = sorted(s,reverse=True)
    print(s)
    for j in range(i):
        if p[i] > s[j]:
            miss += 1
            break

print(n-miss)

n = int(input())
p = list(map(int,input().split()))
cnt = 0
t = p[0]

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


print(cnt)

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

print(count)

N=int(input())
a = [int(x) for x in input().split()]
count=1
mini=a[0]

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

x = P[0]
ans = 0

for i , val in enumerate(P):
    if i == 0:
        ans += 1
    else:
        if val <= x:
            val = x
            ans += 1
print(ans)

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

x = P[0]
ans = 0

for i , val in enumerate(P):
    if val <= x:
        x = val
        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()))

count = 1
for i in range(1,n):

  if min(p[:i]) == p[i]:

    count += 1
print(count)
    

n = int(input())
p = list(map(int, input().split()))
m = p[0]
count = 1
for i in range(1,n):

  m = min(m, p[i])
  if m == p[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):
from collections import deque

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

mx = P[0]
mn = mx
count = 0

cut = list(filter(lambda x:mx >= x,P))
ans = deque()

for a in cut:
    if a == 1:
        break
    if mn >= a:
        mn = a
    else:
        cut.pop(cut.index(a))
print(len(cut))

from collections import deque

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

mx = P[0]
mn = mx
count = 0

ans = deque(list(filter(lambda x:mx >= x,P)))

ln = len(ans)

for a in range(ln):
    num = ans.popleft()
    if mx >= num:
        mx = num
        count += 1
    else:
        continue

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,b = map(int, input().split())
if a==0 or b==0 or (a<0 and b>0):
    print(0)
elif b<0 and (b-a)%2==0:
    print('Negative')
else:
    print('Positive')

a,b = map(int, input().split())
if b==0 or (a<=0 and b>=0):
    print(0)
elif (a<0 and (0-a)%2==1) or (a<0 and b<0 and (b-a)%2==0):
    print('Negative')
else:
    print('Positive')

n = int(input())
p = list(map(int, input().split()))
m = p[0]
ans=1
for i in p[1:]:
    if m>i:
        ans+=1
        m=i
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())
p=list(map(int,input().split()))
ct=1
maxn=p.index(1)
while True:
    if maxn==0:
        break
    p=p[0:maxn]
    i+=1
    maxn=p.index(min(p))
    ct+=1
print(ct)

n=int(input())
p=list(map(int,input().split()))
ct=1
minn=p[0]
for i in range(1,n):
    if minn==1:
        #ct+=1
        break
    elif minn>p[i]:
        minn=p[i]
        ct+=1
print(ct)

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_li = [int(w) for w in input().split()]

ans = 0
used_min = 200000

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



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

ans = 0
used_min = 2000000

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

print(ans)


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())
b= input().split()
compare=b[0]
c=1

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



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

minn = 2e9
cnt = 0
for i in p :
    if (i <= minn) :
        cnt += 1
    minn = min (minn, 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 = [int(i) for i in input().split()]
min = min(P)

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


N = int(input())
P = list(map(int, input().split()))
c = 10**9
count = 0
for i in P:
    
    
    if i < c:
        c=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()))
ans = 0
for i in range(N):
  if(i == 0):
    ans += 1
  else:
    if(P[i] <= i + 1):
      ans += 1
print(str(ans))

N = int(input())
P = list(map(int,input().split()))
mi = P[0]
ans = 0
for i in range(N):
  if(i == 0):
    ans += 1
  else:
    if(P[i] <= mi):
      ans += 1
      mi = P[i]
print(str(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<bits/stdc++.h>
using namespace std;

int main(){
  
  int n;
  cin >> n;
  
  vector<int> lists(n);
  for(int i=0; i<n;i++){
    cin >> lists.at(i);
  }
  
  int ans = 1;
  int std = lists.at(0);
  
  for(int i=1;i<n;i++){
    if(lists.at(i) < std){
      ans += 1;
      std = lists.at(i);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

# abc152

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

std = lists[0]
ans = 1

for i in range(1,n):
    if lists[i] < std:
        ans += 1
        std = lists[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
for i in range(n):
    count = 0
    for j in range(i+1):
        if p[i] <= p[j]:
            count += 1
        print(i, j, p[i], p[j], 'count =', count)
    if count == i + 1:
        ans += 1
print(ans)


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

count = 0
m = p[0]

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

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

cnt = 0
Flg = True
for i in range(N):
    for j in range(i+1):
        if P[j] < P[i]:
            Flg = False
            break
    if Flg:
        cnt += 1
print(cnt)


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

cnt = 0
min_value = N + 1
for i in range(N):
    if P[i] <= min_value:
        cnt += 1
        min_value = 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())
l = input().split()
cnt = 0 

for i in range (N) :
    l[i] = int(l[i])

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

print (cnt)


a= int(input())
b= input().split()
compare=int(b[0])
c=0

for i in range(a):
    if (compare>=int(b[i])):
        compare=int(b[i])
        c=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())
x=list(map(int,input().split()))

count=0
for i in range(0,n-1):
  for j in range(0,i):
    if x[i] > x[j]:
      count=count+1
      break
      
#  if x[i-1]>=x[i]:
#    count=count+1
    
#if min(x)==x[n-1]:
#  count=count+1
print(n-count)


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


min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n-1):
    if min_i[i-1] < x[i]:
        count=count+1
#  if x[i-1]>=x[i]:
#    count=count+1
    
#if min(x)==x[n-1]:
#  count=count+1
print(n-count)


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




min_i = [x[0]]
for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1

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

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

print(cnt)

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

min = 0
cnt = 0
for i in range(N):
  if i == 0:
    cnt += 1
    min = A[i]
    continue
  if A[i] <= min:
    cnt += 1
    min = A[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())
List=list(map(int,input().split()))
num=0

for i in range(N-1):
  if List[i]>=List[i+1]:
    num = num + 1
  else:
    break

print(num+1)

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

N=int(input())
List=list(map(int,input().split()))
num=0

for i in range(N-1):
  if List[i]<List[i+1]:
    num = num + 1
  else:
    break

print(num+1)

N=int(input())
List=list(map(int,input().split()))
num=0

for i in range(N-1):
  if List[i]<=List[i+1]:
    num = num + 1
  else:
    break

print(num+1)

N=int(input())
List=list(map(int,input().split()))
num=1

for i in range(N-1):
  if List[i]>=List[i+1]:
    num = num + 1
  else:
    break

print(num)

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

Verdicts: Wrong Answer

Wrong Answer

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()))
def m(n):
    return min(P[:n+1])
A=[]
if m(i)==P[i] for i in range(N):
    A.append(i)
else:
    pass
print(len(A))

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

ans = 0
n_min = 0
for i in range(0,n):
    if i == 0:
        ans += 1
        n_min = p[i]
        continue
    if p[i] <= n_min:
        ans += 1
        n_min = 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())
data = list(map(int, input().split()))
ans=0
minmin=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(0,N):
        minmin=data[0]
        if data[i]<=minmin:
            minmin=data[i]
            if minmin<=data[i]:
                ans+=1
                continue
        if minmin<=data[i]:
            ans+=1

print(ans)

N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(0,N):
        minmin=data[0]
        if data[i]<=data[i-1]:
            minmin=data[i]
        if minmin<=data[i]:
            ans+=1

print(ans)

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

print(ans)

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

N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(1,N):
        minmin=data[0]
        if data[i]<=minmin:
            minmin=data[i]
            if minmin<=data[i]:
                ans+=1
                continue
        if minmin<=data[i]:
            ans+=1

print(ans)

N=int(input())
data = list(map(int, input().split()))
ans=0
min=data[0]
if N==1:
    ans=1
elif N>1:
    for i in range(0,N):
        minmin=data[0]
        if data[i]<=data[i-1]:
            minmin=data[i]
        if minmin<=data[i]:
            ans+=1

print(ans)

N=int(input())
data = list(map(int, input().split()))
ans=1
minmin=data[0]
if N==1:
    ans=1
elif N>1:
    minmin=data[0]
    for i in range(1,N):

        if data[i]<=minmin:
            minmin=data[i]
            
            ans+=1
                #continue
        
            #ans+=1

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

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

cnt= 0
for i in range(N):
    
    sa = str(i)[0]
    #print(sa)
    if sa == "0":
        #print("break sa", i)
        continue
        
    
    if i%10==0:
        continue
        
    for j in range(N):
        #print(i,j)
        
        
        if j%10==0:
            continue
        
        
        la = str(i)[len(str(i))-1]
        
        
        sb = str(j)[0]
        if sb == "0":
            #print("break sb", j)
            continue
        
        lb= str(j)[len(str(j))-1]
        
        if sa == lb and la == sb:
            #print("({}, {})".format(i,j))
            cnt +=1
    
print(cnt)

import math

N = int(input())

cnt= 0


if N >=10:
    
    cnt+=9
    print(cnt)
    
    
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
else:
    ans = N-1


for i in range(12, N):
    
    sa = str(i)[0]
    
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    
    if i%10==0:
        continue
        
    
    if sa==sb:
        continue
        
    
    if int(sb+sa) <= N:
        #print(i, sb+sa)
        cnt +=1
        
        
        if i/100>=1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

import math

N = int(input())

cnt= 0


if N >=10:
    
    cnt+=9
    print(cnt)
    
    
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
    


for i in range(12, N):
    
    sa = str(i)[0]
    
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    
    if i%10==0:
        continue
        
    
    if sa==sb:
        continue
        
    
    if int(sb+sa) <= N:
        #print(i, sb+sa)
        cnt +=1
        
        
        if i/100>1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

import math

N = int(input())

cnt= 0


if N >=10:
    
    cnt+=9
    print(cnt)
    
    
    sa = str(N)[0]
    sb= str(N)[len(str(N))-1]
    cnt += math.ceil(int(sb)/2) * int(sa)
    print(cnt)
    


for i in range(12, N):
    
    sa = str(i)[0]
    
    sb= str(i)[len(str(i))-1]
    #print(sa)
        
    
    if i%10==0:
        continue
        
    
    if sa==sb:
        continue
        
    
    if int(sb+sa) <= N:
        print(i, sb+sa)
        cnt +=1
        
        
        if i/100>1:
            cnt+=9*math.floor(i/100)
            

print(cnt)

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

m =p[0]
ans =0

for i in range(N):
        #print(m, p[i])
        if m >= p[i]:
            ans+=1
            m=min(m, p[i])    
            continue

print(ans)

Verdicts: Wrong Answer

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())
seq = list(map(int,input().split()))
ans = 1
minim = n

for i in range(1, len(seq)):
    minim = min(minim, seq[i-1])
    print(minim)
    if minim > seq[i]:
        ans += 1

print(ans)

n = int(input())
seq = list(map(int,input().split()))
ans = 1
minim = n

for i in range(1, n):
    minim = min(minim, seq[i-1])
    if minim > seq[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())
list = list(map(int, input().split()))
ans=1

for i in range(n-2):
	for j in range(i+1):
		if list[i+1] < list[j]:
			ans+=1
print(ans)

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

for i in range(n-2):
	for j in range(i+1):
		if list[i+1] < list[j]:
			ans+=1
print(ans)

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

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

print(ans

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

pmin = p[0]
ans = 0
for i in range(n):
    if p[i] <= pmin:
        ans += 1
        pmin = 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):
def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(map(int,input_2().split()))
    print(P_list)
    i_num = 0
    min_P = P_list[0]
    for p in P_list:
        if p <= min_P:
            min_P = p
            i_num += 1
    print(i_num)

if __name__ == "__main__":
    main()

def main():
    N = int(input())
    P_list = list(map(int,input().split()))
    i_num = 0
    min_P = P_list[0]
    for p in P_list:
        if p <= min_P:
            min_P = p
            i_num += 1
    print(i_num)

if __name__ == __main__:
    main()

def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(map(int,input_2().split()))
    i_num = 0
    min_P = P_list[0]
    for p in P_list:
        if p <= min_P:
            min_P = p
            i_num += 1
    print(i_num)

if __name__ == "__main__":
    main()

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):
from functools import lru_cache
@lru_cache(maxsize = None)

N = int(input())
array = list(map(int, input().split()))
cnt = 0

for i in range(0, N):
    for j in range(0, i):
        if array[i] > array[j]:
            break
    else:
        cnt += 1
print(cnt)

N = int(input())
array = list(map(int, input().split()))
cnt = 1
minv = array[0]

for i in range(1, N):
    if minv > array[i]:
        minv = array[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()))

mx = 0
ans = 0
for e in p:
    mx = max(mx, e)
    if e >= mx:
        ans += 1

print(ans)


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

mn = p[0]
ans = 0
for e in p:
    mn = min(mn, e)
    if e <= mn:
        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):
import numpy as np

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


ar_bool = (P >= P.reshape(-1,1))
counta = 0
for i in range(N):
    counta += np.any((ar_bool)[i][:i+1])
print(counta)


import numpy as np

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

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

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

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

import numpy as np

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


for i in range(N):
    N -= np.any(P < P.reshape(-1,1))[i][:i+1]
print(N)

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

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


Verdicts: Runtime Error

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(' ')))
print(sum(1 for i in range(N) if P[i] <= min(P[0:i])))


N = int(input())
P = list(map(int, input().split(' ')))
print(sum(1 for i in range(N) if P[i] <= min(P[:i])))


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

while True:
    count += 1
    tmpMinIndex = li[0:tmpMinIndex]
    if tmpMinIndex == 0:
        break

print(count)


n = int(input())
li = list(map(int, input().split()))
tmpMinIndex = li.index(1)
count = 1

while True:
    if tmpMinIndex == 0:
        break
    li = li[0:tmpMinIndex]
    print(li)
    minNum = min(li)
    print(minNum)
    tmpMinIndex = li.index(minNum)
    count += 1


print(count)


n = int(input())
li = list(map(int, input().split()))
tmpMin = li[0]
count = 0

for i in range(n):
    if li[i] <= tmpMin:
        tmpMin = li[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
N = int(sys.stdin.readline())
nums = [int(x) for x in sys.stdin.readline().split]

ans = 0
_min = float('inf')
for num in nums:
  if _min >= num:
    ans += 1
  _min = min(_min, num)
print(ans)

import sys
N = int(sys.stdin.readline())
nums = [int(x) for x in sys.stdin.readline().split()]
 
ans = 0
_min = float('inf')
for num in nums:
  if _min >= num:
    ans += 1
  _min = min(_min, num)
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())
l=[int(i) for i in input().split()]
c=0
for i in range(n):
  c1=min(l[:i+1])
  if(l[i]==c1):
    c+=1
print(c

n=int(input())
l=[int(i) for i in input().split()]
l1=[]
c=0
l1.append(l[0])
for i in range(1,n):
  l1.append(min(l1[i-1],l[i]))
for i in range(n):
  if(l[i]==l1[i]):
    c+=1
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())
l1=list(map(int,input().split())) 
cnt=0
max1=l1[0]
for i in range(len(l1)):
    
    if l1[i]<=max1:
        cnt=cnt+1
    max1=max(max1,l1[i])    
print(cnt)        

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

result = 0
mini = [P[0]]

for i in range(N-1):
    if mini[i]>P[i+1]:
        mini.append(P[i+1])
    else:
        mini.append(mini[i])

for i in range(N):
    if P[i]==mini[i]:
        result += 1

print(result)


N = int(input())
P = list(map(int, input().split()))
 
result = 0
mini = [P[0]]
 
for i in range(N-1):
    if mini[i]>P[i+1]:
        mini.append(P[i+1])
    else:
        mini.append(mini[i])
 
for i in range(N):
    if P[i]==mini[i]:
        result += 1
 
print(result)

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 x in range(n):
  if p[x] == min(p[:x+1]):
    count += 1

print(count)
    

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

print(count)
    

n = int(input())
p = list(map(int,input().split()))
count = 0
a = p[0]
for x in range(len(p)):
  if p[x] <= a:
    count += 1
    a = p[x]
  
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 = tuple(map(int, input().split()))
cnt = N
for a in P:
    for b in P[:P.index(a)+1]:
        if a > b:
            cnt=-1
            break
print(cnt)

N = int(input())
P = list(map(int, input().split()))
cnt = 0
max = 2*10**5
for a in P:
    if a <=max:
        #print(a)
        cnt += 1
    max = min(max,a)
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):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]>v:
        k+=1
print(k)

a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
print(k)

a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
print(k)

a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
        v=b[i]
print(k)

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

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

print(ans)

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

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

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

print(count)


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

count = 1
if N == 1:
  print(count)
else:
  min = P[0]
  if P[1] <= P[0]:
    count+=1
    min = P[1]

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

print(a)


N = int(input())
P = list(map(int, input().split()))
a=1
i=0
b = P[0]
while i+1 != N:
    if P[i] <= b:
        a+=1
        b = P[i]
    i+=1
print(a)


N = int(input())
P = list(map(int, input().split()))
a=1
i=0
b=P[0]
while i != N:
    if P[i] <= b:
        a+=1
        b=P[i]
    i+=1
print(a)


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


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


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

n = int(input())
lis = list(map(int, input().split()))
 
for a, b in enumerate(lis):
    if b != min(lis[:a+1]) :
        n -= 1
        break
print(n)

n = int(input())
lis = list(map(int, input().split()))
inf = 10 ** 15
ans = 0
for i in lis:
    if i < inf:
        ans += 1
        inf = 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):
a ,b= map(int,input().split())
#S = int(input())

if a > b:
    ans = [str(b)]*a
    ans = "".join(ans)
else:
    ans = [str(a)]*b
    ans = "".join(ans)
print(ans)

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

ans = 0
m = p[0]
for x in p:
    if x <= m:
        ans += 1
    m = max(m, x)
print(ans)

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

ans = 0
m = p[0]
for x in p:
    if x <= m:
        ans += 1
    m = min(m, x)
print(ans)

Verdicts: Wrong Answer

Accepted