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

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

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

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()))
answer = []

for i in range(N):
    count = 0
    for j in range(i + 1):
        if P[i] <= P[j]:
            count += 1
    if count == i:
        answer.append(i)
print(len(answer))


N = int(input())
P = list(map(int, input().split()))
answer = []
count = []

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

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

for i in range(N):
    for j in range(i + 1):
        if P[i] <= P[j]:
            count += 1
    if count == i:
        answer.append(i)
print(answer.count())


N = int(input())
P = list(map(int, input().split()))
answer = 0
minimum = P[0]

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

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

Submission attempts (in order):
N = int(input())
line = list(map(int,input().split()))
a = 0
p = []
for i in N:
    p.append(N)
    if  min(p) >= N:
       a += 1

print(a)

N = int(input())
line = list(map(int,input().split()))
a = 1
m = line[0]
for i in range(N-1):
    if m >= line[i]:
        m = line[i]

    if m >= line[i+1]:
       a += 1

print(a)

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

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

ans = 0
min = P[0]
for i in P:
  if min >= i:
    min = 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):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()


#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

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


if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

Submission attempts (in order):
8
5 7 4 2 6 8 1 3

m = input()
arr = input().split()
cnt = 0
flg = 1
mnn = arr[0]
for n in arr:
  if(int(n)>int(mnn)):
    continue
  else:
    mnn = n
    cnt = 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=[int(i) for i in input().split()]
x=P[0]
a=1
if N==1:
    print(a)
else:
    for i in range(1,N):
        if x>P[i]:
            x=P[i]
            a+=1
        else:
    print(a)

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


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

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

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

print(ans)

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

maxp = 0
ans = 0
for i in p:
    if i < maxp:
        maxp = i
        ans += 1

print(ans)


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

minp = n+1
ans = 0
for i in p:
    if i < minp:
        minp = 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):
def solve(n, P):
  max_val = P.pop(0)
  count = 1
  for p in P:
    if max_val >= p:
      count += 1
    if max_val < p:
      max_val = p
  return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))


def solve(n, P):
  max_val = 1
  count = 0
  for p in P:
    if max_val >= p:
      count += 1
    if max_val < p:
      max_val = p
  return count

_n = int(input())
_P = list(map(int, input().split()))
print(_n, _P)

def solve(n, P):
    min_val = P.pop(0)
    count = 1
    for p in P:
        if min_val >= p:
            count += 1
        if min_val > p:
            min_val = p
    return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))


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

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

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

m=P[0]
c=0
for i in range(N):
  if P[i]<=m:
    c+=1
    m=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())
P =list( map(int, input().split()))
s = P[0]
t = min(P)
Pmin = [P[0]]
for i in range(N - 1):
  if P[i + 1] < Pmin[i]:
    Pmin.append(P[i + 1])
  else:
    Pmin.append(Pmin[i])

print(Pmin)

cnt = 0

for j in range(N):
  if P[j] == Pmin[j]:
    cnt += 1
  else:
    pass
print(cnt)

N = int(input())
P =list( map(int, input().split()))
s = P[0]
t = min(P)
Pmin = [P[0]]
for i in range(N - 1):
  if P[i + 1] < Pmin[i]:
    Pmin.append(P[i + 1])
  else:
    Pmin.append(Pmin[i])

cnt = 0

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

n = int(input())
l = list(map(int,input().split()))
a = 10**9
ans = 0
for i in range(n):

    if l[i] <= a:
        ans += 1
         a = l[i]
print(ans)

n = int(input())
l = list(map(int,input().split()))
a = 10**9
ans = 0
if l[i] <= a:
    ans += 1
    a = l[i]
print(ans)

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

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())
l = list(map(int,input().split()))
min_num = MAX(l) +1
ans = 0
for i in l:
  if min_num >= i:
    min_num = i
    ans += 1
print(ans)

n = int(input())
l = list(map(int,input().split()))
min_num = max(l) +1
ans = 0
for i in l:
  if min_num >= i:
    min_num = i
    ans += 1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

Submission attempts (in order):
n = input()
list = list(map(int,input().split()))
count = 0
minimun_num = 0
for i, val in enumerate(list):
  if i == 0:
    minimun_num = list[0]
  if minimun_num >= val:
    count += 1
  elif min(list[0:i+1]) >= val:
    count += 1
    minimun_num = min(list[0:i+1])
print("%d"%(count))

n = input()
list = list(map(int,input().split()))
count = 0
minimun_num = 0
for i, val in enumerate(list):
  if i == 0:
    minimun_num = min(list[0:i+1])
  if minimun_num >= val:
    count += 1
  elif min(list[0:i+1]) >= val:
    count += 1
    minimun_num = min(list[0:i+1])
print("%d"%(count))

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

print("%d"%(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())
p = list(map(int, input().split()))

def code(n,p)
  for idx, pp in enumerate(p):
    if pp>n:
      return idx

idx = code(n,p)
print(idx)
    

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

def code(n,p):
    flg = 1

    for idx in range(1,n):
        if min(p[0:idx]) >= p[idx]:
            flg+=1
            print(p[idx])
    return flg

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)


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

def code(n,p):
  for idx, pp in enumerate(p):
    if pp>n:
      return idx

idx = code(n,p)
print(idx)


def code(n,p):
    flg = 1

    for idx in range(1,n):
        if min(p[0:idx]) >= p[idx]:
            flg+=1
            print(p[idx])
    return flg

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)


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

def code(n,p):
  for idx, pp in enumerate(p):
    if pp>n:
      return idx

idx = code(n,p)
if idx == None:
  print(n)
else:
  print(idx)


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

def code(n,p):
  answer = 0
  for idx, pp in enumerate(p):
    if pp>n:
      answer = idx+1
      
  return idx

idx = code(n,p)
if idx == None:
  print(n)
else:
  print(idx)


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

Verdicts: Runtime Error

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())
p = [int(x) for x in input.split()]
ans = 0
mn = n
for i in p:
  if mn > i:
    mn = i
  if mn >= i:
    ans += 1
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

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

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

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

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

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

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

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

P = [0] + P
     
count = 0
for i in range(1, N+1):
    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[-j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
else:
    print(count)

N = int(input())

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

P = [0] + P
     
count = 0
min = 10000000000000
for i in range(1, N+1):
    if min > P[i]:
        min = P[i]
    elif min < P[i]:
        continue
    """
    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
    """
    count += 1
        
    if P[i] == 1:
        break

print(count)

Verdicts: Wrong Answer

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

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

ans = 0
min_v = N


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

print (ans)



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

ans = 0
min_v = N
for i in range(0, N):
    if i > min_v:
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = i

print (ans)



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

ans = 0
min = N
for i in range(0, N):
    if i > min:
        continue:
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min = i

print (ans)



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

ans = 0
min_v = N
for i in range(0, N):
    if P[i] > min_v:
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = i

print (ans)



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

ans = 0
min_v = -1
for i in range(0, N):
    if P[i] < min_v:
        ans += 1
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = P[i]

print (ans)



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

ans = 0
min_v = P[0]

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

print (ans)



Verdicts: Runtime Error

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

tmpma=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)

n = int(input())
a = list(map(int, input().split()))
 
tmpmin=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
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())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0
if n!=1:
  for i in range (n):
    if mi>m[i]:
      mi=m[i]
      h+=1
    g+=1
  print(h)
else:
  print(n)

n = int(input())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0
if n!=1:
  for i in range (n):
    if mi>m[i]:
      mi=m[i]
      h+=1
    g+=1
  print(h)
else:
  print(n)

n = int(input())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0
if n!=1:
  for i in range (n):
    if mi>m[i]:
      mi=m[i]
      h+=1
    g+=1
  print(h)
else:
  print(n)

n = int(input())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0
if n!=1:
  for i in range (n):
    if mi>m[i]:
      mi=m[i]
      h+=1
    g+=1
  print(h)
else:
  print(n)

n = int(input())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0

for i in range (n):
  if mi>m[i]:
    mi=m[i]
    h+=1

    
print(h)


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_n = list(input().split())

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

print(result)

N = int(input())

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

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

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

c = 1
if p_list == [p_list[0]]*N:
    print(len(p_list))

elif p_list == sorted(p_list):
    print(1)

elif p_list == sorted(p_list, reverse=True):
    print(len(p_list))

else:
    for i in range(1, N):
        p_list_min = min(p_list[:i])
            if p_list[i] <= p_list_min:
                c += 1
        

print(c)


N = int(input())
p_list  = list(map(int,input().strip().split(" ")))

ans = 1
mi = p_list[0]

for i in range(1, N):
    if mi >= p_list[i]:
        ans += 1
        mi = p_list[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

class Node:
    def __init__(self, data): 
        self.data = data 
        self.left = None 
        self.right = None 


class BST:
    def __init__(self, number_list): 
        self.root = None 
        for node in number_list: 
            self.insert(node) 
    
    def insert(self, data):
        n = self.root
        if n == None:
            self.root = Node(data)
            return
        else:
            while True:
                entry = n.data
                if data < entry:
                    if n.left is None:
                        n.left = Node(data)
                        return
                    n = n.left
                elif data > entry:
                    if n.right is None:
                        n.right = Node(data)
                        return
                    n = n.right
                else:
                    n.data = data
                    return
    def count(self, ans):
        n = self.root
        while True:
        		if n != None:
          			ans += 1
          			n = n.left
        return ans

tree = BST(p)
ans = tree.count(0)

print(ans)

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

class Node:
    def __init__(self, data): 
        self.data = data 
        self.left = None 
        self.right = None 


class BST:
    def __init__(self, number_list): 
        self.root = None 
        for node in number_list: 
            self.insert(node) 
    
    def insert(self, data):
        n = self.root
        if n == None:
            self.root = Node(data)
            return
        else:
            while True:
                entry = n.data
                if data < entry:
                    if n.left is None:
                        n.left = Node(data)
                        return
                    n = n.left
                elif data > entry:
                    if n.right is None:
                        n.right = Node(data)
                        return
                    n = n.right
                else:
                    n.data = data
                    return


	def count(self):
		ans = 0
		n = self.root
		while True:
		if n != None:
			ans += 1
			n = n.left
		return ans


tree = BST(p)
tree.count()
print(ans)

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

Verdicts: Time Limit Exceeded

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

count = 0
temp = []
flg = False

for idx, num in enumerate(nums):
  temp.append(num)
  
  if idx == 1:
      count += 1
  else:
    for _ in temp:
      if _ < num:
        flg = True
    if flg == False:
      count += 1
    
print(count)

N = int(input())

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

min = None
count = 0

for idx, num in enumerate(nums):
    if idx == 0:
        min = num
        count += 1
        continue
    
    if min >= num:
        count += 1
        min = 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):
ln=10
bit=[0]*ln

def up(id):
    while id<ln:
        bit[id]+=1
        id+=id&(-id)
def qr(id):
    res=0
    while id:
        res+=bit[id]
        id-=id&(-id)
    return res

res=0

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

st=sorted(list(set(s)),reverse=True)
dc={}
id=1
for n in st:
    dc[n]=id
    id+=1


for n in range(x):
    up(dc[s[n]])
    p=qr(dc[s[n]])
    #print(p)
    res+=int(p!=0)
    

print(res)

def readinput():
    n=int(input())
    p=list(map(int,input().split()))
    return n,p

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

if __name__=='__main__':
    n,p=readinput()
    ans=main(n,p)
    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):

import numpy as np

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

AC = np.array([0]*N) 
WA = np.array([0]*N) 

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": 
        WA[int(p)-1] += 1              
    else:
        AC[int(p)-1] = 1               
    
print(sum(AC), sum(WA*AC)) 



N = 8
P = [5, 7, 4, 2, 6, 8, 1, 3]

smallest_so_far = float("inf")
cnt = 0

for the_num in P:
    if the_num < smallest_so_far :
        smallest_so_far = the_num
        cnt += 1
print(cnt)

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

smallest_so_far = float("inf")
cnt = 0

for the_num in P:
    if the_num < smallest_so_far :
        smallest_so_far = the_num
        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):
s = [(input()) for i in range(2)]
N = int(s[0])
t = s[1]
a = 1000000
b = 1
for i in range(N - 1):
    a = min(a,int(t[i]))
    k = i + 1
    c = int(t[k])
    if a >= c:
        b = b + 1
print(b)

N = int(input())
s = [int(input()) for i in range(N)]
a = 10000000000
b = 1
for i in range(N - 1):
    a = min(a,s[i])
    if a >= s[i + 1]:
        b = b + 1
print(b)

s = [(input().split()) for i in range(2)]
N = int(s[0][0])
t = s[1]
a = 1000000
b = 1
for i in range(N - 1):
    a = min(a,int(t[i]))
    c = int(t[i + 1])
    if a >= c:
        b = b + 1
print(b)

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())
A = list(map(int, input().split()))
ans = 0
cnt = 0
for index, i in enumerate(A):
    #print("index:{}".format(index))
    for j in range(index + 1):
        if i > A[j] or A[j] == 1:
            #print("break:{}".format(j))
            break
        elif index == j:
            ans += 1
            break

print(ans)

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


for index, i in enumerate(A):
    if index == 0:
        ans += 1
        small = i


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

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

n = int(input())
for i in range(n):
  	l = list(map(int, input().split()))
   
print(min(n, max(0, min(l)-1)))

n = int(input())
l = list(map(int, input().split()))
           
score = 0
m = 1e17
for i in l:
	if i<m:
		m = i
		score += 1
	
print(score)


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 = [int(i) for i in input().split()]
count = 0
for i in range(n):
    if p[i] <= max(p[0:i]) if i != 0 else p[0]:
        count += 1
print(count)

n = int(input())
p = [int(i) for i in input().split()]
min = n+1
count = 0
for i in range(n):
    if min >= p[i]+1:
        count += 1
        min = p[i]+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):
a=int(input())
b=map(int,input().split())
c=[]
d=0
for i in range(a):
  c.append(b[i])
  if min(c)>=b[i]:
    d+=1
  else:
    pass
print(d)
    
    


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


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


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

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
m=s[0]
for i in range(1,n):
    if s[i]==1:
        ans=ans+1
    elif p[i]>m:
        continue
    else
        ans=ans+1
        m=s[i]
print(ans)

n=int(input())
p=list(map(int,input().split()))
ans=1
m=p[0]
for i in range(1,len(p)):
    if p[i]==1:
        ans=ans+1
        break
    elif p[i]>m:
        continue
    else:
        ans=ans+1
        m=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()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max==1:
    break
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
print(cnt)
    

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

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

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

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

print(ans)


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

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

print(ans)


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

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

cnt = 0             
check_list = []     

に一つずつ値をセット
for i in input_v_list:
    check_list.append(i)
    min_var = min(check_list)
    
    if(i <= min_var):
        cnt += 1


print(cnt)

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

cnt = 0             
min_var = 2 * 10**6 


for i in input_v_list:
    
    
    if(min_var > i):
        min_var = i

    
    if(i <= min_var):
        cnt += 1


print(cnt)

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):
def solve(n, p_list):

    count = 0
    j = 2 * 10^^5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    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 = input()
P = input().split(' ')
count = 0
print(P)
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = int(Pi)

    elif Pmin>=int(P[i]):
        count = count +1
        Pmin = int(Pi)


print(count)

N = input()
P = input().split(' ')
count = 0
PM = min(P)
for i, Pi in enumerate(P):
    Pmin = Pi
    if i == 0:
        count = count +1
    elif Pi == PM:
        count = count +1
        break
    elif Pmin< P[i]:
        pass
    elif Pi<= Pmin:
        count = count +1
        Pmin = Pi
print(count)

N = input()
P = input().split(' ')

for i, Pi in enumerate(P):
    if i == 0:
        count = 1
    elif Pi == min(P):
        break
    elif Pi<= min(P[0:i]):
        count = count +1
print(count)

N = input()
P = input().split(' ')
count = 0
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = int(Pi)

    elif Pmin>=int(P[i]):
        count = count +1
        Pmin = int(Pi)


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())
list = [int(i) for i in input().split()]
a = 0

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

    a += 1
    
print(a)

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

N = P.index(1)
a = 1
j = P[0]
for i in range(N):
    if j >= P[i+1]:
        j = P[i+1]
        a +=1


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())
M = 0
for P in map(int, input().split()):
    if P <= N:
        N = x
        M += 1
print(M)

N = int(input())
M = 0
for P in map(int, input().split()):
    if P <= N:
        N = P
        M += 1
print(M)

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

N=int(input())
A = list(map(int, input().split()))
if N==1:
    print(1)
else:
    count=0
    for i in range(N-1):
        for j in range(i,N):
            if A[i]<=A[j]:
                count=count+1
                break
    print(count)

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

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

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=1

if N==1:
    print(1)
elif N==2:
    if P[1] < P[0]:
        print(2)
    else:
        print(1)
else:
    tmp = P[i-2]
    for i in range(2,N):
        if P[i] < min(P[i-1],tmp):
            tmp = min(P[i-1],tmp)
            cnt+=1
    print(cnt)

N=int(input())
P=list(map(int, input().split()))
 
cnt=1
 
if N==1:
    print(1)
elif N==2:
    if P[1] < P[0]:
        print(2)
    else:
        print(1)
else:
    tmp = P[0]
    for i in range(2,N):
        if P[i] < min(P[i-1],tmp):
            tmp = min(P[i-1],tmp)
            cnt+=1
    print(cnt)

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

cnt=1

if N==1:
    print(1)
elif N==2:
    if P[1] < P[0]:
        print(2)
    else:
        print(1)
else:
    tmp = P[0]
    if P[1] <= P[0]:
        cnt +=1
    for i in range(2,N):
        tmp = min(P[i-1],tmp)
        if P[i] <= tmp:
            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):
def main(length_num,num_list):
    count_num = 0
    for i in range(0,length_num):
        flag_tag = True
        for j in range(0 , i ):
          if int(num_list[i]) >= int(num_list[j]):
              print(num_list[i],num_list[j])
              flag_tag = False
              break
        if flag_tag != False:
            count_num += 1
    return count_num


    
if __name__ == "__main__":
    input_length_num = int(input())
    input_num2 = input()
    input_num_list = input_num2.split()
    print(main(length_num,num_list))

def main(length_num,num_list):
    count_num = 0
    min_num = int(num_list[0])
    for i in num_list:
        if int(min_num) >= int(i):
            min_num = i
            count_num += 1           
    return count_num
    
if __name__ == "__main__":
    input_length_num = int(input())
    input_num2 = input()
    input_num_list = input_num2.split()
    print(main(input_length_num,input_num_list))

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


n = int(input())
ls = [int(x) for x in input().split()]
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)


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

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

counter=0
for i in range(N):
  Pj_list=[]
  for j in range(i):
    Pj=List[j]
    Pj_list.append(Pj)
  Mi=min(Pj_list)
  if Mi==List[i]:
    counter+=1

print(counter)

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

counter=0
mj=N
for i in range(N):
  if mj>List[i]:
    mj=List[i]
  if List[i]==mj:
    counter+=1
print(counter)

Verdicts: Runtime Error

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

Submission attempts (in order):
n = input()
p = list(int(i) for i in input().split())
count = 1
for i in range(1,len(p)):
  if(p[i - 1] >= p[i]):
    count += 1
  print(p[i])

print(count) 


n = input()
p = list(int(i) for i in input().split())
p_test = sorted(p)
count = 1
for i in range(1,len(p)):
  if(p[i] <= min(p_test[0:i])):
    count += 1

print(count) 


n = input()
p = list(int(i) for i in input().split())
p_test = sorted(p)
count = 1
for i in range(1,len(p)):
  if(p[i] <= p_test[0]):
    count += 1

print(count) 


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

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())
S = list(map(int,input().split()))
counter = int(0)
minNum = S[0]

if N == 1:
  print("1")

else:
  for i in range(N):
    if minNum >= S[i]:
      counter = counter + 1
    else:
      minNum = S[i]
    
  print(counter)

N = int(input())
S = list(map(int,input().split()))
counter = int(0)
minNum = S[0]

if N == 1:
  print("1")

else:
  for i in range(N):
    if minNum >= S[i]:
      minNum = S[i]
      counter = counter + 1
    
  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):
N=int(input())
P=list(map(int,input().split()))
x=0
for i in range(N):
    B=0
    a=P[i]
    for j in range(i+1):
        b=P[j]
        if a>b:
            break
        else:
            B+=1
    if i+1==B:
        x+=1
    print(a,b,B)
print(x)

N=int(input())
P=list(map(int,input().split()))
x=0
for i in range(N):
    B=0
    a=P[i]
    for j in range(i+1):
        b=P[j]
        if a>b:
            break
        else:
            B+=1
    if i+1==B:
        x+=1
    print(a,b,B)
print(x)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:    * For any integer j (1 \leq j \leq i), P_i \leq P_j.

Submission attempts (in order):
N = int(input())
P = list(map(int,input().split()))
P_min = [2*(10**5)]
for i in range(N-1):
    P_min.append(min(P_min[i],P[i]))
print(P_min)
ans = 0
for i in range(N):
    if P_min[i] >= P[i]:
        ans += 1
print(ans)


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

n=int(input())
p=[int(i) for i in input().split()]
ans=1
for i in range(1,n):
    for j in range(i):
        if (p[i]>p[j]):
            ans-=1
            break
        
print(ans)

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

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

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


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


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

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

Verdicts: Runtime Error

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

answer = 0
m = 0
for i in range(n):
  if i == 0:
    answer += 1
    m = p[i]
  elif p[i] <= m:
    answer += 1
    min = p[i]

print(answer)

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

answer = 0
m = 0
for i in range(n):
    if i == 0:
        answer += 1
        m = p[i]
        continue
    if p[i] <= m:
        answer += 1
        m = p[i]

print(answer)

Verdicts: Wrong Answer

Accepted