結果

問題 No.3085 Easy Problems
コンテスト
ユーザー vjudge1
提出日時 2026-02-06 00:01:31
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
TLE  
実行時間 -
コード長 1,057 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,618 ms
コンパイル使用メモリ 221,912 KB
実行使用メモリ 7,968 KB
最終ジャッジ日時 2026-02-06 00:01:43
合計ジャッジ時間 12,252 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// BISMILLAH
// AUTHOR: KAMRAN
// Date: 2026-02-05 18:55

#include <bits/stdc++.h>
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());
  

    int m;
    cin>>m;
    while(m--){
        pair<int,int>y;
        cin>>y.first>>y.second;
        int cnt=0;
        vector<int>temp(n);
        for(int i=0;i<n;i++){
            if(x[i].second == y.second)cnt++;

            temp[i]=cnt;
        }


    int low=0;
    int high=n-1;
    while(low<=high){
        int mid=(low+high)/2;
        if(x[mid].first>y.first)high=mid-1;
        else low=mid+1;
    }
    if(low==0){
        cout<<0<<nl;
        continue;
    }else{
        low-=(temp[low-1]);
    }

    cout<<low<<nl;
    }


  

};

signed main() {
    fast;

// int t;
// cin>>t;

// while(t--)

solve();

    return 0;
}   

/*
2 2 3 5 10

5 50 500

*/
0