結果

問題 No.2710 How many more?
ユーザー watayu
提出日時 2024-03-31 14:57:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 86,912 KB
最終ジャッジ日時 2024-09-30 20:07:58
合計ジャッジ時間 6,763 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n, q = map(int,input().split())
A = [int(i)*-1 for i in input().split()]
R = sorted(A)
for i in range(q):
	x,y=map(int, input().split())
	ans=bisect.bisect_right(R,A[x-1])-bisect.bisect_left(R,A[y-1])
	if A[x-1] >= A[y-1]:
		print(0)
	else:
		print(-1*ans)
0