結果

問題 No.2710 How many more?
ユーザー n_nan_na
提出日時 2024-04-01 22:29:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 460 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,600 KB
最終ジャッジ日時 2024-04-01 22:29:19
合計ジャッジ時間 7,532 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 376 ms
84,296 KB
testcase_03 AC 289 ms
84,448 KB
testcase_04 AC 215 ms
91,240 KB
testcase_05 AC 187 ms
82,148 KB
testcase_06 AC 195 ms
87,728 KB
testcase_07 AC 242 ms
77,276 KB
testcase_08 AC 217 ms
77,980 KB
testcase_09 AC 327 ms
87,684 KB
testcase_10 AC 248 ms
81,760 KB
testcase_11 AC 321 ms
79,996 KB
testcase_12 AC 432 ms
89,616 KB
testcase_13 AC 425 ms
91,600 KB
testcase_14 AC 447 ms
91,596 KB
testcase_15 AC 453 ms
91,596 KB
testcase_16 AC 443 ms
91,600 KB
testcase_17 AC 460 ms
91,600 KB
testcase_18 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

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,Y = A[x-1],A[y-1]
    if X <= Y:
        print(0)
    else:
        lft = bisect.bisect_right(B, Y)
        rgt = bisect.bisect_left(B, X)
        print(rgt - lft)
0