結果

問題 No.2710 How many more?
ユーザー 👑 Nafmo2Nafmo2
提出日時 2024-01-22 19:35:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,055 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 21,024 KB
最終ジャッジ日時 2024-03-28 12:15:58
合計ジャッジ時間 12,830 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,856 KB
testcase_01 AC 30 ms
9,856 KB
testcase_02 AC 926 ms
16,576 KB
testcase_03 AC 502 ms
16,944 KB
testcase_04 AC 310 ms
20,320 KB
testcase_05 AC 269 ms
15,132 KB
testcase_06 AC 265 ms
18,912 KB
testcase_07 AC 406 ms
10,624 KB
testcase_08 AC 287 ms
12,404 KB
testcase_09 AC 742 ms
18,368 KB
testcase_10 AC 418 ms
14,480 KB
testcase_11 AC 731 ms
13,748 KB
testcase_12 AC 977 ms
20,040 KB
testcase_13 AC 1,055 ms
21,024 KB
testcase_14 AC 1,045 ms
21,024 KB
testcase_15 AC 1,050 ms
21,024 KB
testcase_16 AC 1,053 ms
21,024 KB
testcase_17 AC 1,045 ms
21,024 KB
testcase_18 AC 30 ms
9,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#! /usr/bin/env python3
import bisect
N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
while Q>0:
    x, y = map(int, input().split())
    x-=1
    y-=1
    ans = bisect.bisect_left(B,A[x])-bisect.bisect_right(B,A[y])
    print(max(ans,0))
    Q-=1

0