結果

問題 No.3085 Easy Problems
コンテスト
ユーザー Meso Meso
提出日時 2025-12-10 19:02:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 821 ms / 2,000 ms
コード長 410 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 297 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 107,060 KB
最終ジャッジ日時 2025-12-10 19:03:05
合計ジャッジ時間 26,273 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import bisect

n = int(input())
A, B = [], [[] for _ in range(10**5+1)]
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B[b].append(a)

A.sort()
for i in range(len(B)):
    B[i].sort()
    
q = int(input())
ans = []
for i in range(q):
    x, y = map(int, input().split())
    t = bisect.bisect_right(A, x) - bisect.bisect_right(B[y], x)
    ans.append(t)

for s in ans:
    print(s)
0