結果

問題 No.2710 How many more?
ユーザー MichirakaraMichirakara
提出日時 2024-03-31 13:58:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 155,080 KB
最終ジャッジ日時 2024-03-31 13:58:23
合計ジャッジ時間 8,562 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
68,244 KB
testcase_01 AC 60 ms
68,244 KB
testcase_02 WA -
testcase_03 AC 383 ms
119,564 KB
testcase_04 AC 344 ms
153,780 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 445 ms
137,560 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 590 ms
155,068 KB
testcase_17 AC 591 ms
155,072 KB
testcase_18 AC 58 ms
68,244 KB
権限があれば一括ダウンロードができます

ソースコード

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