結果
| 問題 | No.3085 Easy  Problems | 
| コンテスト | |
| ユーザー |  eve__fuyuki | 
| 提出日時 | 2025-04-07 17:39:10 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 226 ms / 2,000 ms | 
| コード長 | 686 bytes | 
| コンパイル時間 | 2,532 ms | 
| コンパイル使用メモリ | 199,240 KB | 
| 実行使用メモリ | 9,612 KB | 
| 最終ジャッジ日時 | 2025-04-07 17:39:27 | 
| 合計ジャッジ時間 | 16,497 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
}
int main() {
	fast_io();
	int n;
	cin >> n;
	vector<int> tot;
	const int M = 1e5 + 5;
	vector<vector<int>> sep(M);
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		tot.push_back(a);
		sep[b].push_back(a);
	}
	sort(tot.begin(), tot.end());
	for (int i = 0; i < M; i++) {
		sort(sep[i].begin(), sep[i].end());
	}
	int q;
	cin >> q;
	for (; q--;) {
		int x, y;
		cin >> x >> y;
		int ans = lower_bound(tot.begin(), tot.end(), x + 1) - tot.begin();
		ans -=
			lower_bound(sep[y].begin(), sep[y].end(), x + 1) - sep[y].begin();
		cout << ans << "\n";
	}
}
            
            
            
        