結果

問題 No.2710 How many more?
コンテスト
ユーザー maccha
提出日時 2024-03-31 15:11:51
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 490 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 282 ms
コンパイル使用メモリ 21,208 KB
実行使用メモリ 66,384 KB
最終ジャッジ日時 2026-09-06 23:44:10
合計ジャッジ時間 11,840 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

a,b=map(int,input().split())
x=list(map(int,input().split()))
z=sorted(list(set(x)))
w=[set([]) for i in range(len(z))]
W=[[] for i in range(len(z))]
p={}
d=[0 for i in range(a)]
for i in range(len(z)):
    p[z[i]]=i
s=0 
for i in range(a):
    w[p[x[i]]].add(i)
    d[i]=p[x[i]]
for i in range(len(w)):
    s+=len(w[i])
    W[i]=s
for i in range(b):
    c=list(map(int,input().split()))
    c[0]-=1;c[1]-=1
    #print(d[c[0]],d[c[1]])
    print(max(W[d[c[0]]]-W[d[c[1]]]-1,0))
    #print()
0