結果

問題 No.2710 How many more?
ユーザー sasa8uyauya
提出日時 2024-04-05 14:01:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 512 ms / 2,000 ms
コード長 234 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 92,444 KB
最終ジャッジ日時 2024-10-01 01:06:50
合計ジャッジ時間 7,366 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q=map(int,input().split())
a=list(map(int,input().split()))
b=sorted(a)
from bisect import bisect_left,bisect_right
for i in range(q):
	x,y=map(int,input().split())
	x-=1
	y-=1
	print(max(0,bisect_left(b,a[x])-bisect_right(b,a[y])))
0