結果
| 問題 | No.3085 Easy  Problems | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-04-04 21:31:00 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 477 bytes | 
| コンパイル時間 | 867 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 65,408 KB | 
| 最終ジャッジ日時 | 2025-04-04 21:32:45 | 
| 合計ジャッジ時間 | 5,089 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 2 | 
| other | RE * 31 | 
ソースコード
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)
            
            
            
        