結果

問題 No.2710 How many more?
ユーザー CecilCecil
提出日時 2024-03-31 14:47:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 994 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 21,048 KB
最終ジャッジ日時 2024-03-31 14:47:21
合計ジャッジ時間 12,621 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 30 ms
9,984 KB
testcase_02 AC 824 ms
16,600 KB
testcase_03 AC 479 ms
16,964 KB
testcase_04 AC 300 ms
20,340 KB
testcase_05 AC 257 ms
15,156 KB
testcase_06 AC 277 ms
18,932 KB
testcase_07 AC 382 ms
10,752 KB
testcase_08 AC 264 ms
12,416 KB
testcase_09 AC 711 ms
18,388 KB
testcase_10 AC 385 ms
14,500 KB
testcase_11 AC 686 ms
13,744 KB
testcase_12 AC 882 ms
20,060 KB
testcase_13 AC 986 ms
21,048 KB
testcase_14 AC 975 ms
21,048 KB
testcase_15 AC 994 ms
21,048 KB
testcase_16 AC 960 ms
21,048 KB
testcase_17 AC 989 ms
21,048 KB
testcase_18 AC 29 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N,Q = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] *= -1
tmp_A = A.copy()
tmp_A.sort()

for _ in range(Q):
    x,y = map(int, input().split())
    l = bisect.bisect_right(tmp_A, A[x-1])
    r = bisect.bisect_left(tmp_A, A[y-1])
    if r-l<=0:
        print(0)
    else:
        print(r-l)
0