結果

問題 No.2710 How many more?
ユーザー tkykwtnb
提出日時 2024-04-04 12:40:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 47,768 KB
最終ジャッジ日時 2024-10-01 00:22:27
合計ジャッジ時間 13,237 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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={}
i=0
for L in D:
    i+=len(L[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)
0