結果

問題 No.2710 How many more?
ユーザー shobonvipshobonvip
提出日時 2024-04-01 01:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 465 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,472 KB
最終ジャッジ日時 2024-04-01 01:42:51
合計ジャッジ時間 8,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 385 ms
84,168 KB
testcase_03 AC 267 ms
84,320 KB
testcase_04 AC 211 ms
91,112 KB
testcase_05 AC 191 ms
82,020 KB
testcase_06 AC 222 ms
87,600 KB
testcase_07 AC 253 ms
77,276 KB
testcase_08 AC 193 ms
77,980 KB
testcase_09 AC 335 ms
87,556 KB
testcase_10 AC 242 ms
81,760 KB
testcase_11 AC 330 ms
79,996 KB
testcase_12 AC 420 ms
89,488 KB
testcase_13 AC 465 ms
91,472 KB
testcase_14 AC 440 ms
91,468 KB
testcase_15 AC 436 ms
91,468 KB
testcase_16 AC 464 ms
91,472 KB
testcase_17 AC 428 ms
91,472 KB
testcase_18 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
n,q=map(int,input().split())
a=list(map(int,input().split()))
b=sorted(a)
for i in range(q):
	x,y=map(int,input().split())
	x-=1
	y-=1
	if a[x]<=a[y]:
		print(0)
	else:
		f = bisect.bisect_right(b,a[y])
		g = bisect.bisect_left(b,a[x])
		print(g-f)
0