結果

問題 No.2710 How many more?
ユーザー graph11463graph11463
提出日時 2024-03-31 15:18:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 129,556 KB
最終ジャッジ日時 2024-03-31 15:18:28
合計ジャッジ時間 6,037 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 34 ms
53,332 KB
testcase_02 AC 339 ms
107,464 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

'''input'''
i1=lambda:int(s1())
i2=lambda:map(int,s2())
il=lambda:list(i2())
s1=lambda:input()
s2=lambda:s1().split()
sl=lambda:list(s2())
'''output'''
yn=lambda b:print("Yes" if b else "No")
'''createList'''
cl=lambda x,d:[d for i in range(x)]# a=c2l(10,23,"x")
'''code'''
N,Q=i2()
A=il()
S = sorted(list(set(A)))
ranking = {x:i+1 for i,x in enumerate(S)}
z = []
for a in A:
    z.append(ranking[a])
for i in range(Q):
    n,m=i2()
    if z[n-1]-z[m-1]>0:
        if z[n-1]-z[m-1]==1:
            print(1)
        else:
            print(z[n-1]-z[m-1]-1)
    else:
        print(0)
0