結果
| 問題 |
No.2710 How many more?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-01 21:23:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 527 ms / 2,000 ms |
| コード長 | 309 bytes |
| コンパイル時間 | 567 ms |
| コンパイル使用メモリ | 82,520 KB |
| 実行使用メモリ | 92,492 KB |
| 最終ジャッジ日時 | 2024-11-01 21:23:41 |
| 合計ジャッジ時間 | 8,214 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
from bisect import bisect_left, bisect_right
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 -= 1
y -= 1
xx = bisect_left(B, A[x])
yy = bisect_right(B, A[y])
ans = max(0, xx - yy)
print(ans)