結果

問題 No.2710 How many more?
ユーザー watayuwatayu
提出日時 2024-03-31 14:57:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 564 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 86,148 KB
最終ジャッジ日時 2024-03-31 14:57:40
合計ジャッジ時間 7,951 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 460 ms
81,264 KB
testcase_03 AC 315 ms
81,420 KB
testcase_04 AC 244 ms
85,792 KB
testcase_05 AC 235 ms
80,076 KB
testcase_06 AC 230 ms
83,616 KB
testcase_07 AC 278 ms
77,404 KB
testcase_08 AC 231 ms
77,952 KB
testcase_09 AC 406 ms
83,576 KB
testcase_10 AC 285 ms
80,304 KB
testcase_11 AC 399 ms
79,132 KB
testcase_12 AC 500 ms
84,884 KB
testcase_13 AC 522 ms
86,148 KB
testcase_14 AC 564 ms
86,144 KB
testcase_15 AC 524 ms
86,148 KB
testcase_16 AC 527 ms
86,144 KB
testcase_17 AC 525 ms
86,144 KB
testcase_18 AC 39 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n, q = map(int,input().split())
A = [int(i)*-1 for i in input().split()]
R = sorted(A)
for i in range(q):
	x,y=map(int, input().split())
	ans=bisect.bisect_right(R,A[x-1])-bisect.bisect_left(R,A[y-1])
	if A[x-1] >= A[y-1]:
		print(0)
	else:
		print(-1*ans)
0