結果

問題 No.2710 How many more?
ユーザー 👑 rin204rin204
提出日時 2024-04-07 14:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 527 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,608 KB
最終ジャッジ日時 2024-04-07 14:24:37
合計ジャッジ時間 7,842 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,332 KB
testcase_01 AC 37 ms
53,332 KB
testcase_02 AC 454 ms
84,172 KB
testcase_03 AC 309 ms
84,320 KB
testcase_04 AC 244 ms
91,132 KB
testcase_05 AC 227 ms
81,788 KB
testcase_06 AC 226 ms
87,604 KB
testcase_07 AC 278 ms
77,268 KB
testcase_08 AC 224 ms
78,128 KB
testcase_09 AC 385 ms
87,556 KB
testcase_10 AC 275 ms
81,768 KB
testcase_11 AC 414 ms
80,268 KB
testcase_12 AC 473 ms
89,500 KB
testcase_13 AC 505 ms
91,348 KB
testcase_14 AC 505 ms
91,608 KB
testcase_15 AC 505 ms
91,600 KB
testcase_16 AC 527 ms
91,600 KB
testcase_17 AC 505 ms
91,348 KB
testcase_18 AC 38 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

n, Q = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
for _ in range(Q):
    x, y = map(int, input().split())
    x = A[x - 1]
    y = A[y - 1]
    ans = bisect_left(B, x) - bisect_right(B, y)
    print(max(ans, 0))
0