結果

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

ソースコード

diff #
raw source code

// BISMILLAH
// created by kamran
// Date: 2026-01-06 02:19

#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
signed main() {
    fast;
    int n;
    cin>>n;
    map<int,vector<int>>x;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        x[b].push_back(a);
    }
    for(auto &i:x)sort(i.second.begin(),i.second.end());

    int m;
    cin>>m;
    while(m--){
        int a,b;
        cin>>a>>b;
        int ans=0;
        for(auto &i:x){
            if(i.first == b)continue;
            else {
                int low=0;
                int high=i.second.size()-1;
                while(low<=high){
                    int mid=(high+low)/2;
                    if(i.second[mid]>a)high=mid-1;
                    else low=mid+1;
                }
                ans+=(low);
            }
        }
        cout<<ans<<nl;
    }


    return 0;
}
0