結果

問題 No.2710 How many more?
ユーザー detteiuudetteiuu
提出日時 2024-04-11 02:09:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 91,676 KB
最終ジャッジ日時 2024-04-11 02:09:38
合計ジャッジ時間 6,814 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,968 KB
testcase_01 AC 41 ms
52,224 KB
testcase_02 AC 275 ms
89,128 KB
testcase_03 AC 201 ms
85,312 KB
testcase_04 AC 178 ms
90,880 KB
testcase_05 AC 157 ms
82,672 KB
testcase_06 AC 165 ms
87,680 KB
testcase_07 AC 172 ms
82,764 KB
testcase_08 AC 194 ms
80,708 KB
testcase_09 AC 240 ms
88,008 KB
testcase_10 AC 183 ms
82,688 KB
testcase_11 AC 232 ms
86,116 KB
testcase_12 AC 290 ms
89,728 KB
testcase_13 AC 381 ms
91,480 KB
testcase_14 AC 304 ms
91,616 KB
testcase_15 AC 289 ms
91,652 KB
testcase_16 AC 308 ms
91,676 KB
testcase_17 AC 382 ms
91,664 KB
testcase_18 AC 41 ms
52,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

N, Q = map(int, input().split())
A = list(map(int, input().split()))
query = [list(map(int, input().split())) for _ in range(Q)]

S = sorted(A)
for i in range(Q):
    x, y = query[i]
    if A[x-1] <= A[y-1]:
        print(0)
    else:
        print(bisect_left(S, A[x-1])-bisect_right(S, A[y-1]))
0