結果
| 問題 | No.3085 Easy Problems |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-01-03 18:04:06 |
| 言語 | Python3 (3.14.2 + numpy 2.4.0 + scipy 1.16.3) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,126 bytes |
| 記録 | |
| コンパイル時間 | 613 ms |
| コンパイル使用メモリ | 21,664 KB |
| 実行使用メモリ | 91,612 KB |
| 最終ジャッジ日時 | 2026-01-03 18:05:23 |
| 合計ジャッジ時間 | 71,010 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 TLE * 28 |
ソースコード
def count_safe_challenges(N, challenges, Q, heroes):
from bisect import bisect_right
from collections import defaultdict
challenges.sort()
difficulties = [ch[0] for ch in challenges]
type_dict = defaultdict(list)
for difficulty, ctype in challenges:
type_dict[ctype].append(difficulty)
for ctype in type_dict:
type_dict[ctype].sort()
results = []
for strength, weakness in heroes:
total_count = bisect_right(difficulties, strength)
if weakness in type_dict:
weak_difficulties = type_dict[weakness]
weak_count = bisect_right(weak_difficulties, strength)
total_count -= weak_count
results.append(total_count)
return results
if __name__ == "__main__":
N = int(input().strip())
challenges = [tuple(map(int, input().strip().split())) for _ in range(N)]
Q = int(input().strip())
heroes = [tuple(map(int, input().strip().split())) for _ in range(Q)]
results = count_safe_challenges(N, challenges, Q, heroes)
for res in results:
print(res)
vjudge1