結果

問題 No.2710 How many more?
ユーザー cologne
提出日時 2025-05-27 15:24:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 513 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 94,368 KB
最終ジャッジ日時 2025-05-27 15:24:23
合計ジャッジ時間 8,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #


import bisect


def main():
    n, q = map(int, input().split())
    *a, = map(int, input().split())
    b = sorted(a)
    for i in range(q):
        y, x = map(int, input().split())
        print(max(0, bisect.bisect_left(
            b, a[y-1]) - bisect.bisect_right(b, a[x-1])))


if __name__ == '__main__':
    main()
0