結果

問題 No.2710 How many more?
ユーザー ButterflvButterflv
提出日時 2024-04-18 11:01:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 92,288 KB
最終ジャッジ日時 2024-04-18 11:01:46
合計ジャッジ時間 7,007 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,724 KB
testcase_01 AC 33 ms
54,096 KB
testcase_02 AC 420 ms
84,600 KB
testcase_03 AC 262 ms
84,720 KB
testcase_04 AC 241 ms
91,508 KB
testcase_05 AC 210 ms
82,568 KB
testcase_06 AC 206 ms
88,016 KB
testcase_07 AC 240 ms
77,496 KB
testcase_08 AC 193 ms
78,744 KB
testcase_09 AC 378 ms
87,896 KB
testcase_10 AC 238 ms
82,196 KB
testcase_11 AC 339 ms
80,920 KB
testcase_12 AC 400 ms
90,260 KB
testcase_13 AC 476 ms
91,840 KB
testcase_14 AC 425 ms
91,944 KB
testcase_15 AC 437 ms
91,944 KB
testcase_16 AC 461 ms
92,288 KB
testcase_17 AC 450 ms
91,620 KB
testcase_18 AC 35 ms
52,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for _ in range(Q):
  x, y=map(int, input().split())
  rightIND=bisect.bisect_left(B, A[x-1])
  leftIND=bisect.bisect_right(B, A[y-1])
  print(max(0, rightIND-leftIND))
0