結果

問題 No.2710 How many more?
ユーザー akia_Sakia_S
提出日時 2024-03-31 15:12:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 112,528 KB
最終ジャッジ日時 2024-03-31 15:12:15
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,460 KB
testcase_01 AC 45 ms
53,460 KB
testcase_02 AC 426 ms
103,820 KB
testcase_03 AC 293 ms
104,080 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 218 ms
77,400 KB
testcase_08 AC 194 ms
83,032 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 341 ms
88,344 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 41 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

from collections import defaultdict
num=defaultdict(int)
d = defaultdict(int)

n,q=map(int,input().split())
a=list(map(int,input().split()))

for i,x in enumerate(a):
    num[i+1]=x
#print(num[1])
a.sort()
d[0]=0
for i in range(n):
    d[a[i]]=i+1

 
#print(d)

for i in range(q):
    x,y=map(int,input().split())
    x2,y2=num[x],num[y]
    #print(x2,y2)
    print(d[x2]-d[y2]-1 if d[x2]>d[y2] else 0)
0