結果

問題 No.3085 Easy Problems
ユーザー 回転
提出日時 2025-04-04 21:27:06
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 541 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 67,488 KB
最終ジャッジ日時 2025-04-04 21:27:21
合計ジャッジ時間 4,789 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from sortedcontainers import SortedList
N = int(input())
all = SortedList()
for _ in range(N):
    a,b = list(map(int,input().split()))
    all.add((a,b,-1))
Q = int(input())
for i in range(Q):
    x,y = list(map(int,input().split()))
    all.add((x,y,i))

ans = [-1 for _ in range(Q)]
bunya = defaultdict(int)
prob_count = 0
for i in range(N+Q):
    a,b,c = all[i]
    if(c == -1):
        bunya[b] += 1
        prob_count += 1
    else:
        ans[c] = prob_count - bunya[b]

for i in ans:
    print(i)
0