結果

問題 No.2710 How many more?
ユーザー 👑 rin204
提出日時 2024-04-07 14:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 92,064 KB
最終ジャッジ日時 2024-10-01 04:29:38
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

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())
    x = A[x - 1]
    y = A[y - 1]
    ans = bisect_left(B, x) - bisect_right(B, y)
    print(max(ans, 0))
0