結果
| 問題 | No.3085 Easy  Problems | 
| コンテスト | |
| ユーザー |  寝癖 | 
| 提出日時 | 2025-04-04 21:28:55 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,171 ms / 2,000 ms | 
| コード長 | 406 bytes | 
| コンパイル時間 | 947 ms | 
| コンパイル使用メモリ | 82,372 KB | 
| 実行使用メモリ | 101,232 KB | 
| 最終ジャッジ日時 | 2025-04-04 21:30:52 | 
| 合計ジャッジ時間 | 35,951 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
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)
            
            
            
        