結果

問題 No.3085 Easy Problems
ユーザー SPD_9X2
提出日時 2025-04-04 21:54:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 790 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 112,700 KB
最終ジャッジ日時 2025-04-04 21:55:30
合計ジャッジ時間 25,704 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""
import bisect

N = int(input())

A = []

B2A = [ [] for i in range(10**5+1)]

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B2A[b].append(a)

A.sort()
for i in range(len(B2A)):
    B2A[i].sort()

Q = int(input())
ANS = []

for i in range(Q):

    X,Y = map(int,input().split())

    ans = bisect.bisect_right(A,X) - bisect.bisect_right(B2A[Y],X)

    ANS.append(ans)

print (*ANS,sep="\n")
0