結果

問題 No.2710 How many more?
ユーザー titia
提出日時 2024-04-28 03:54:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 861 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,824 KB
最終ジャッジ日時 2024-11-16 13:19:57
合計ジャッジ時間 10,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect,bisect_left

N,Q=map(int,input().split())
A=list(map(int,input().split()))

SA=sorted(A)

for tests in range(Q):
    x,y=map(int,input().split())

    p=A[x-1]
    q=A[y-1]

    if p<=q:
        print(0)
        continue

    x=bisect(SA,q)
    y=bisect_left(SA,p)

    print(y-x)
0