結果

問題 No.2710 How many more?
ユーザー macchamaccha
提出日時 2024-03-31 15:11:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 62,240 KB
最終ジャッジ日時 2024-03-31 15:12:06
合計ジャッジ時間 13,700 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,112 KB
testcase_01 AC 27 ms
10,112 KB
testcase_02 AC 887 ms
39,856 KB
testcase_03 AC 553 ms
41,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 363 ms
12,924 KB
testcase_08 AC 290 ms
20,212 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 656 ms
26,420 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 27 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b=map(int,input().split())
x=list(map(int,input().split()))
z=sorted(list(set(x)))
w=[set([]) for i in range(len(z))]
W=[[] for i in range(len(z))]
p={}
d=[0 for i in range(a)]
for i in range(len(z)):
    p[z[i]]=i
s=0 
for i in range(a):
    w[p[x[i]]].add(i)
    d[i]=p[x[i]]
for i in range(len(w)):
    s+=len(w[i])
    W[i]=s
for i in range(b):
    c=list(map(int,input().split()))
    c[0]-=1;c[1]-=1
    #print(d[c[0]],d[c[1]])
    print(max(W[d[c[0]]]-W[d[c[1]]]-1,0))
    #print()
0