結果
| 問題 | 
                            No.2710 How many more?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             かもめのうで
                         | 
                    
| 提出日時 | 2024-03-31 14:57:36 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 321 bytes | 
| コンパイル時間 | 357 ms | 
| コンパイル使用メモリ | 82,532 KB | 
| 実行使用メモリ | 93,340 KB | 
| 最終ジャッジ日時 | 2024-09-30 20:08:05 | 
| 合計ジャッジ時間 | 6,266 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 6 WA * 11 | 
ソースコード
from bisect import bisect_left
n, q = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(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))
            
            
            
        
            
かもめのうで