結果

問題 No.3085 Easy Problems
ユーザー umezo
提出日時 2025-04-04 21:30:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 4,908 ms
コンパイル使用メモリ 280,780 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2025-04-04 21:32:03
合計ジャッジ時間 14,371 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;

V<int> G[100100];
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  V<int> A(n),B(n);
  rep(i,n){
    cin>>A[i]>>B[i];
    G[B[i]].push_back(A[i]);
  }
  sort(ALL(A));
  rep(i,100100) sort(ALL(G[i]));
  int q;
  cin>>q;
  while(q--){
    int a,b;
    cin>>a>>b;
    auto u=upper_bound(ALL(A),a)-A.begin();
    auto g=upper_bound(ALL(G[b]),a)-G[b].begin();
    cout<<u-g<<'\n';
  }
    
  return 0;
}
0