結果

問題 No.3085 Easy Problems
コンテスト
ユーザー vjudge1
提出日時 2026-02-17 23:36:25
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 807 ms / 2,000 ms
コード長 913 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,169 ms
コンパイル使用メモリ 228,172 KB
実行使用メモリ 17,696 KB
最終ジャッジ日時 2026-02-17 23:36:54
合計ジャッジ時間 28,782 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// BISMILLAH
// AUTHOR: KAMRAN
// Date: 2026-02-17 19:16

#include <bits/stdc++.h>
#include <climits>
#include <utility>
using namespace std;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  int long long
#define nl endl
 
void solve(){
    int n;
    cin>>n;
    vector<pair<int,int>>x(n);
    for(int i=0;i<n;i++){
        cin>>x[i].first>>x[i].second;
    }

    sort(x.begin(),x.end());
    map<int,vector<int>>y;
    for(int i=0;i<n;i++){
        y[x[i].second].push_back(x[i].first);
    }
    int m;
    cin>>m;
    while(m--){
        pair<int,int>z;
        cin>>z.first>>z.second;
        int total=upper_bound(x.begin(),x.end(),make_pair(z.first,LLONG_MAX))-x.begin();
        int temp=z.second;
        int ele=upper_bound(y[temp].begin(),y[temp].end(),z.first)-y[temp].begin();

        cout<<total-ele<<nl;
    }

};

signed main() {
    fast;

solve();

    return 0;
}
0