結果
| 問題 | 
                            No.2710 How many more?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             かもめのうで
                         | 
                    
| 提出日時 | 2024-03-31 14:55:07 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 325 bytes | 
| コンパイル時間 | 484 ms | 
| コンパイル使用メモリ | 81,972 KB | 
| 実行使用メモリ | 108,408 KB | 
| 最終ジャッジ日時 | 2024-09-30 20:06:30 | 
| 合計ジャッジ時間 | 5,828 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 WA * 12 | 
ソースコード
from bisect import bisect_left
n, q = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(set(a))
cnt = [-1]*n
for i, ai in enumerate(a):
    junnni = bisect_left(b, ai)
    cnt[i] = junnni
for _ in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(max(0, cnt[x]-cnt[y]-1))
            
            
            
        
            
かもめのうで