結果
| 問題 |
No.2710 How many more?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:54:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 552 ms / 2,000 ms |
| コード長 | 368 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 108,232 KB |
| 最終ジャッジ日時 | 2024-09-30 20:04:54 |
| 合計ジャッジ時間 | 7,520 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
from collections import defaultdict import bisect N, Q = map(int, input().split()) A = list(map(int, input().split())) B = sorted(A) rank = defaultdict(int) for i in range(N): rank[i] = A[i] for i in range(Q): x, y = map(int, input().split()) posx = bisect.bisect_left(B, rank[x - 1]) posy = bisect.bisect_right(B, rank[y - 1]) print(max(posx - posy, 0))