結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,332 KB
testcase_01 AC 40 ms
53,332 KB
testcase_02 AC 489 ms
84,172 KB
testcase_03 AC 339 ms
84,320 KB
testcase_04 AC 255 ms
91,128 KB
testcase_05 AC 246 ms
82,048 KB
testcase_06 AC 238 ms
87,604 KB
testcase_07 AC 285 ms
77,256 KB
testcase_08 AC 237 ms
78,252 KB
testcase_09 AC 436 ms
87,556 KB
testcase_10 AC 293 ms
81,892 KB
testcase_11 AC 406 ms
80,388 KB
testcase_12 AC 499 ms
89,500 KB
testcase_13 AC 513 ms
91,348 KB
testcase_14 AC 522 ms
91,472 KB
testcase_15 AC 525 ms
91,344 KB
testcase_16 AC 515 ms
91,472 KB
testcase_17 AC 531 ms
91,348 KB
testcase_18 AC 39 ms
53,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 標準入力された値を整数に変換する
def INT():
    return int(input())


# 標準入力された複数の値を整数に変換する
def MI():
    return map(int, input().split())


# 標準入力された複数の値を整数のリストに変換する
def LI():
    return list(map(int, input().split()))


from bisect import bisect_left, bisect_right

N, Q = MI()
A = LI()
As = sorted(A)

for i in range(Q):
    x, y = MI()
    x -= 1
    y -= 1
    ans = max(bisect_left(As, A[x]) - bisect_right(As, A[y]), 0)
    print(ans)
0