結果

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

ソースコード

diff #
raw source code

import sys
from collections import defaultdict
input = sys.stdin.readline
N=int(input())
qs=[]
for _ in range(N):
    a,b=map(int, input().split())
    qs.append((a,0,b))
Q=int(input())
for i in range(Q):
    x,y=map(int, input().split())
    qs.append((x,1,y,i))
count = 0
dic =defaultdict(int)
ans=[0]*Q
qs.sort()
for q in qs:
    if q[1]==0:
        count+=1
        dic[q[2]]+=1
    else:
        ans[q[3]]=count-dic[q[2]]
for a in ans:
    print(a)
0