結果

問題 No.2710 How many more?
ユーザー 👑 Nafmo2Nafmo2
提出日時 2024-01-22 19:36:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 540 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,732 KB
最終ジャッジ日時 2024-01-22 19:47:45
合計ジャッジ時間 7,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 455 ms
84,300 KB
testcase_03 AC 313 ms
84,448 KB
testcase_04 AC 247 ms
91,260 KB
testcase_05 AC 232 ms
81,920 KB
testcase_06 AC 227 ms
87,732 KB
testcase_07 AC 275 ms
77,268 KB
testcase_08 AC 232 ms
78,128 KB
testcase_09 AC 391 ms
87,684 KB
testcase_10 AC 275 ms
81,896 KB
testcase_11 AC 392 ms
80,396 KB
testcase_12 AC 522 ms
89,628 KB
testcase_13 AC 511 ms
91,476 KB
testcase_14 AC 512 ms
91,732 KB
testcase_15 AC 513 ms
91,728 KB
testcase_16 AC 511 ms
91,728 KB
testcase_17 AC 540 ms
91,476 KB
testcase_18 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
while Q > 0:
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    ans = bisect.bisect_left(B, A[x]) - bisect.bisect_right(B, A[y])
    print(max(ans, 0))
    Q -= 1
0