結果
| 問題 |
No.3085 Easy Problems
|
| コンテスト | |
| ユーザー |
Cecil
|
| 提出日時 | 2025-04-04 21:42:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 875 ms / 2,000 ms |
| コード長 | 596 bytes |
| コンパイル時間 | 2,169 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 114,824 KB |
| 最終ジャッジ日時 | 2025-04-04 21:43:22 |
| 合計ジャッジ時間 | 27,466 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
from collections import defaultdict as dd
from bisect import bisect_right
N = int(input())
sub_all = list()
sub_per = dd(list)
for _ in range(N):
a,b = map(int, input().split())
sub_all.append(a)
sub_per[b].append(a)
sub_all.sort()
for k in sub_per.keys():
sub_per[k].sort()
#print(sub_all)
#print(sub_per)
Q = int(input())
ans = list()
for _ in range(Q):
x,y = map(int, input().split())
cnt = bisect_right(sub_all, x)
cnt -= bisect_right(sub_per[y],x)
#print("#",bisect_right(sub_all, x),bisect_right(sub_per[y],x))
ans.append(cnt)
for a in ans:
print(a)
Cecil