結果

問題 No.2710 How many more?
ユーザー Michirakara
提出日時 2024-03-31 13:58:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 155,736 KB
最終ジャッジ日時 2024-09-30 18:42:57
合計ジャッジ時間 8,676 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import Counter
n,q=map(int,input().split())
a=[*map(int,input().split())]
cntr=Counter(a)
dists=sorted(set(a))
idx=dict()
dic=dict()
now=0
for i in range(len(dists)):
	idx[dists[i]]=i
	now+=cntr[dists[i]]
	dic[dists[i]]=now
for _ in range(q):
	x,y=map(int,input().split())
	x-=1
	y-=1
	print(max(0,dic[dists[idx[a[x]]-1]]-dic[a[y]]))
0