結果

問題 No.2710 How many more?
ユーザー shobonvip
提出日時 2024-04-01 01:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 92,064 KB
最終ジャッジ日時 2024-09-30 21:35:01
合計ジャッジ時間 6,057 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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