結果

問題 No.3085 Easy Problems
コンテスト
ユーザー vjudge1
提出日時 2026-01-03 17:43:08
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
MLE  
実行時間 -
コード長 786 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 740 ms
コンパイル使用メモリ 21,668 KB
実行使用メモリ 817,968 KB
最終ジャッジ日時 2026-01-03 17:43:16
合計ジャッジ時間 5,957 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 1 -- * 1
other -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict

n = int(input())
max_difficulty = 1000000 
challenges = []
for _ in range(n):
    a, b = map(int, input().split())
    challenges.append((a, b))
counts = [[0] * (max_difficulty + 1) for _ in range(max_difficulty + 1)]

for difficulty, challenge_type in challenges:
    counts[difficulty][challenge_type] += 1

cumulative_counts = [0] * (max_difficulty + 1)
for d in range(1, max_difficulty + 1):
    cumulative_counts[d] = cumulative_counts[d - 1] + sum(counts[d])

q = int(input())
for _ in range(q):
    x, y = map(int, input().split())
    if x == 1000000000:
        print(0)
        continue
    
    count = 0
    for difficulty in range(1, x + 1):
        count += cumulative_counts[difficulty] - counts[difficulty][y]
    
    print(count)

0