結果

問題 No.3085 Easy Problems
ユーザー amentorimaru
提出日時 2025-04-04 20:46:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 580 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 95,072 KB
最終ジャッジ日時 2025-04-04 20:47:03
合計ジャッジ時間 19,281 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import bisect
input = sys.stdin.readline
def read_values(): return map(int, input().split())



def main():
  n = int(input())
  c0 = list()
  c = [list() for _ in range(100000)]
  for _ in range(n):
     a,b=read_values()
     c0.append(a)
     c[b-1].append(a)
  c0.sort()
  for i in range(100000):
     c[i].sort()
  q=int(input())
  for _ in range(q):
     x,y=read_values()
     print(bisect.bisect_left(c0,x+1)-bisect.bisect_left(c[y-1],x+1))
        
if __name__ == "__main__":
    main()
0