結果

問題 No.2710 How many more?
ユーザー 👑 timitimi
提出日時 2024-03-31 14:21:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 127,036 KB
最終ジャッジ日時 2024-03-31 14:21:59
合計ジャッジ時間 6,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 401 ms
117,564 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 202 ms
77,252 KB
testcase_08 AC 179 ms
85,516 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 316 ms
94,296 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int, input().split())
A=list(map(int, input().split()))
E={}
for a in A:
  if a not in E:
    E[a]=0
  E[a]+=1
  
B=sorted(list(set(A)))
D={}
for i in range(len(B)):
  D[B[i]]=i+1

F=[0]
for b in B:
  F.append(F[-1])
  F[-1]+=E[b]

for i in range(Q):
  p,q=map(int, input().split())
  p-=1;q-=1
  p,q=D[A[p]],D[A[q]]
  print(max(0,p-q-1))
  
  
0