結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-04-01 02:12:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 541 ms / 2,000 ms |
コード長 | 318 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 92,960 KB |
最終ジャッジ日時 | 2024-09-30 21:37:22 |
合計ジャッジ時間 | 8,050 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
from bisect import bisect_left n, q = map(int, input().split()) a = list(map(int, input().split())) b = list(sorted(a)) for _ in range(q): x, y = map(int, input().split()) x -= 1 y -= 1 # a[x]未満の個数 ans = bisect_left(b, a[x]) # a[y]以下の個数 ans -= bisect_left(b, a[y] + 1) print(max(0, ans))