結果
| 問題 | No.2710 How many more? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-01-22 19:36:05 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 470 ms / 2,000 ms | 
| コード長 | 273 bytes | 
| コンパイル時間 | 290 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 91,948 KB | 
| 最終ジャッジ日時 | 2024-09-28 06:28:36 | 
| 合計ジャッジ時間 | 7,158 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 | 
ソースコード
import bisect
N, Q = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A)
while Q > 0:
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    ans = bisect.bisect_left(B, A[x]) - bisect.bisect_right(B, A[y])
    print(max(ans, 0))
    Q -= 1
            
            
            
        