結果

問題 No.2710 How many more?
ユーザー loop0919loop0919
提出日時 2024-03-31 14:05:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,348 KB
最終ジャッジ日時 2024-03-31 14:06:04
合計ジャッジ時間 7,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,332 KB
testcase_01 AC 36 ms
53,332 KB
testcase_02 AC 433 ms
84,172 KB
testcase_03 AC 345 ms
84,320 KB
testcase_04 AC 236 ms
91,128 KB
testcase_05 AC 221 ms
81,920 KB
testcase_06 AC 221 ms
87,604 KB
testcase_07 AC 263 ms
77,000 KB
testcase_08 AC 249 ms
78,000 KB
testcase_09 AC 382 ms
87,556 KB
testcase_10 AC 270 ms
81,768 KB
testcase_11 AC 399 ms
80,260 KB
testcase_12 AC 452 ms
89,500 KB
testcase_13 AC 506 ms
91,348 KB
testcase_14 AC 483 ms
91,344 KB
testcase_15 AC 486 ms
91,344 KB
testcase_16 AC 509 ms
91,344 KB
testcase_17 AC 482 ms
91,348 KB
testcase_18 AC 36 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

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

for _ in range(Q):
    x, y = map(lambda x: int(x) - 1, input().split())
    print(max(bisect_left(sorted_A, A[x]) - bisect_right(sorted_A, A[y]), 0))
0