結果

問題 No.3085 Easy Problems
コンテスト
ユーザー amentorimaru
提出日時 2025-04-04 20:44:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,209 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 29,408 KB
最終ジャッジ日時 2025-04-04 20:45:12
合計ジャッジ時間 38,266 ms
ジャッジサーバーID
(参考情報)
judge2 / 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