結果

問題 No.3085 Easy Problems
ユーザー 学ぶマン
提出日時 2025-04-04 21:29:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 830 ms / 2,000 ms
コード長 1,517 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 82,828 KB
実行使用メモリ 114,176 KB
最終ジャッジ日時 2025-04-04 21:30:57
合計ジャッジ時間 25,389 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
sys.setrecursionlimit(10**8)
sys.set_int_max_str_digits(0)
INF = 10**18
MOD = 998244353
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import product, combinations, permutations, groupby, accumulate
from heapq import heapify, heappop, heappush
def I():   return sys.stdin.readline().rstrip()
def II():  return int(sys.stdin.readline().rstrip())
def IS():  return sys.stdin.readline().rstrip().split()
def MII(): return map(int, sys.stdin.readline().rstrip().split())
def LI():  return list(sys.stdin.readline().rstrip())
def TII(): return tuple(map(int, sys.stdin.readline().rstrip().split()))
def LII(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LSI(): return list(map(str, sys.stdin.readline().rstrip().split()))
def GMI(): return list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
def kiriage(a, b): return (a+b-1)//b
#def check(i:int, j:int): return 0 <= i < H and 0 <= j < W

def cnt_ika(li, x): # x 以下の要素数
    return bisect_right(li, x)

N = II()
zembu = []
problems = [list() for _ in range(10**5 + 1)]
for i in range(N):
    a, b = MII()
    problems[b].append(a)
    zembu.append(a)

Q = II()
query = [TII() for _ in range(Q)]

for i in range(10**5 + 1):
    problems[i].sort()
zembu.sort()

for x, y in query:
    # zembu の中で x以下のもの
    ans = cnt_ika(zembu, x)
    # 苦手分野で x以下のもの
    ans -= cnt_ika(problems[y], x)
    print(ans)
    
0