Created
January 9, 2021 02:24
-
-
Save Irene-123/39e6710cffc1d97b3d6694de8916593e to your computer and use it in GitHub Desktop.
MOnk and search //Error filled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=int(input()) | |
arr=list(map(int,input().split()))[:n] | |
arr.sort | |
q=int(input()) | |
ques=[input().split() for i in range(q)] | |
for que in ques: | |
count=0 | |
if que[0]=='0': | |
for i in range(n-1,-1,-1): | |
if arr[i]< int(que[1]): | |
break | |
count+=1 | |
print(count) | |
else: | |
for i in range(n-1,-1,-1): | |
if arr[i]<= int(que[1]): | |
break | |
count+=1 | |
print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment