結果
| 問題 | No.3085 Easy  Problems | 
| コンテスト | |
| ユーザー |  zawakasu | 
| 提出日時 | 2025-04-04 21:26:56 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 218 ms / 2,000 ms | 
| コード長 | 1,039 bytes | 
| コンパイル時間 | 995 ms | 
| コンパイル使用メモリ | 113,708 KB | 
| 実行使用メモリ | 10,468 KB | 
| 最終ジャッジ日時 | 2025-04-04 21:27:12 | 
| 合計ジャッジ時間 | 9,993 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
#include <iostream>
#include <iomanip>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
// #include "Src/Utility/BinarySearch.hpp"
// #include "Src/Sequence/CompressedSequence.hpp"
// #include "Src/Sequence/RunLengthEncoding.hpp"
// using namespace zawa;
// #include "atcoder/modint"
// using mint = atcoder::modint998244353;
int N;
std::pair<int, int> AB[200010];
std::vector<int> ord[100010];
int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cin >> N;
    for (int i = 0 ; i < N ; i++) std::cin >> AB[i].first >> AB[i].second;
    std::sort(AB, AB + N);
    for (int i = 0 ; i < N ; i++) ord[AB[i].second].push_back(i);
    int Q;
    std::cin >> Q;
    while (Q--) {
        int X, Y;
        std::cin >> X >> Y;
        auto it = std::lower_bound(AB, AB + N, std::pair{X, (int)1e9}) - AB;
        auto jt = std::lower_bound(ord[Y].begin(), ord[Y].end(), it) - ord[Y].begin();
        std::cout << it - jt << '\n';
    }
}
            
            
            
        