結果

問題 No.3085 Easy Problems
コンテスト
ユーザー ルク
提出日時 2025-04-04 21:31:00
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 477 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 475 ms
コンパイル使用メモリ 96,016 KB
実行使用メモリ 91,392 KB
最終ジャッジ日時 2026-07-08 08:43:40
合計ジャッジ時間 9,254 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from sortedcontainers import SortedList
import bisect

n = int(input())
items = [list(map(int, input().split())) for i in range(n)]
items.sort(key=lambda x: (x[0], x[1]))
cnt = [SortedList() for _ in range(10**5+30)]
idxs = []
for i in range(n):
    idxs.append(items[i][0])
    cnt[items[i][1]].add(items[i][0])
idxs.sort()
q = int(input())
for i in range(q):
    x, y = map(int, input().split())
    ans = bisect.bisect_right(idxs, x) - cnt[y].bisect_right(x)
    print(ans)
0