結果

問題 No.3085 Easy Problems
コンテスト
ユーザー 寝癖
提出日時 2025-04-04 21:28:55
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 740 ms / 2,000 ms
コード長 406 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,183 ms
コンパイル使用メモリ 95,980 KB
実行使用メモリ 108,312 KB
最終ジャッジ日時 2026-07-08 08:39:58
合計ジャッジ時間 24,607 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from bisect import bisect_right

N = int(input())
d = {}
A = []
for _ in range(N):
    a, b = map(int, input().split())
    if not b in d:
        d[b] = []
    d[b].append(a)
    A.append(a)

for k in d.keys():
    d[k].sort()
A.sort()

Q = int(input())
for i in range(Q):
    x, y = map(int, input().split())
    cnt = bisect_right(A, x)
    if y in d:
        cnt -= bisect_right(d[y], x)
    print(cnt)
0