結果

問題 No.2710 How many more?
ユーザー pitPpitP
提出日時 2024-03-31 14:02:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 464 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,600 KB
最終ジャッジ日時 2024-03-31 14:03:00
合計ジャッジ時間 6,849 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 396 ms
84,296 KB
testcase_03 AC 270 ms
84,448 KB
testcase_04 AC 217 ms
91,244 KB
testcase_05 AC 198 ms
82,408 KB
testcase_06 AC 199 ms
87,732 KB
testcase_07 AC 241 ms
77,276 KB
testcase_08 AC 210 ms
77,980 KB
testcase_09 AC 340 ms
87,684 KB
testcase_10 AC 246 ms
81,760 KB
testcase_11 AC 338 ms
79,996 KB
testcase_12 AC 443 ms
89,620 KB
testcase_13 AC 440 ms
91,600 KB
testcase_14 AC 435 ms
91,600 KB
testcase_15 AC 460 ms
91,600 KB
testcase_16 AC 441 ms
91,600 KB
testcase_17 AC 464 ms
91,600 KB
testcase_18 AC 39 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right
N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = A[:]
B.sort()
# print(B)

for _ in range(Q):
    xq, yq = map(int, input().split())
    xq -= 1
    yq -= 1
    # print(A[xq], A[yq])
    if A[xq] <= A[yq]:
        print(0)
    else:
        r = bisect_left(B, A[xq])
        l = bisect_right(B, A[yq])
        print(r - l)
0