結果

問題 No.2710 How many more?
ユーザー ゆ
提出日時 2024-03-31 13:57:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 97,556 KB
最終ジャッジ日時 2024-03-31 13:58:13
合計ジャッジ時間 5,005 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,628 KB
testcase_01 AC 43 ms
55,628 KB
testcase_02 AC 246 ms
87,764 KB
testcase_03 AC 195 ms
87,920 KB
testcase_04 AC 193 ms
97,168 KB
testcase_05 AC 159 ms
84,640 KB
testcase_06 AC 170 ms
92,248 KB
testcase_07 AC 159 ms
77,816 KB
testcase_08 AC 154 ms
78,972 KB
testcase_09 AC 237 ms
92,204 KB
testcase_10 AC 176 ms
83,792 KB
testcase_11 AC 208 ms
81,432 KB
testcase_12 AC 261 ms
94,800 KB
testcase_13 AC 300 ms
97,556 KB
testcase_14 AC 274 ms
97,428 KB
testcase_15 AC 277 ms
97,428 KB
testcase_16 AC 280 ms
97,556 KB
testcase_17 AC 282 ms
97,556 KB
testcase_18 AC 40 ms
55,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# oj t -c "python3 main.py"
import sys,math
from collections import defaultdict,deque
from itertools import combinations,permutations,accumulate,product
from bisect import bisect,bisect_left,bisect_right
from heapq import heappop,heappush,heapify
#from sortedcontainers import SortedList,SortedSet
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def ms(): return map(int, input().split())
def li(): return list(map(int,input().split()))
inf = pow(10,18)
#////////////////////////////////////
N,Q = ms()
A = li()
B = list()
for a in A: B.append(a)
B.sort()
for _ in range(Q):
  x,y = ms()
  l = bisect_left(B,A[x-1])
  r = bisect_right(B,A[y-1])
  print(max(l-r,0))

0