結果

問題 No.2710 How many more?
ユーザー hiro1729
提出日時 2024-03-31 13:44:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 91,776 KB
最終ジャッジ日時 2024-09-30 18:19:47
合計ジャッジ時間 6,985 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left as bs
N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
for _ in range(Q):
	x, y = map(int, input().split())
	print(max(0, bs(B, A[x - 1]) - bs(B, A[y - 1] + 1)))
0