結果

問題 No.3085 Easy Problems
ユーザー moon17
提出日時 2025-04-04 21:36:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,044 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 150,452 KB
最終ジャッジ日時 2025-04-04 21:39:14
合計ジャッジ時間 31,224 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import*
from bisect import*
n=int(input())
ab=[[*map(int,input().split())]for _ in range(n)]
q=int(input())
xy=[[*map(int,input().split())]for _ in range(q)]
d=defaultdict(list)
s=[]
for a,b in ab:
  d[b]+=a,
  s+=a,
s.sort()
for k in d:
  d[k].sort()
for x,y in xy:
  ans=bisect(s,x)-bisect(d[y],x)
  print(ans)
0