結果
| 問題 | No.2710 How many more? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-10 15:27:21 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 309 ms / 2,000 ms |
| + 582µs | |
| コード長 | 434 bytes |
| 記録 | |
| コンパイル時間 | 69 ms |
| コンパイル使用メモリ | 81,408 KB |
| 実行使用メモリ | 104,832 KB |
| 最終ジャッジ日時 | 2026-09-09 02:49:05 |
| 合計ジャッジ時間 | 7,682 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
from bisect import bisect_left, bisect_right
def main():
N, Q = map(int, input().split())
A = list(map(int, input().split()))
A_sorted = sorted(map(lambda elm: -elm, A))
for _ in range(Q):
x, y = map(lambda n: int(n) - 1, input().split())
idx_x = bisect_right(A_sorted, -A[x])
idx_y = bisect_left(A_sorted, -A[y])
print(max(0, idx_y - idx_x))
if __name__ == "__main__":
main()