結果
| 問題 | No.2710 How many more? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-04-04 12:27:02 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 360 bytes | 
| コンパイル時間 | 165 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 47,608 KB | 
| 最終ジャッジ日時 | 2024-10-01 00:22:02 | 
| 合計ジャッジ時間 | 13,602 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 WA * 12 | 
ソースコード
N,Q=map(int,input().split())
A=list(map(int,input().split()))
from collections import defaultdict
D=defaultdict(list)
for i,a in enumerate(A,1):
    D[a].append(i)
D=sorted(D.items())
P={}
for i,L in enumerate(D,1):
    for p in L[1]:
        P[p]=i
for _ in range(Q):
    x,y=map(int,input().split())
    if P[x]-P[y]-1>0:print(P[x]-P[y]-1)
    else:print(0)
            
            
            
        