結果

問題 No.3085 Easy Problems
ユーザー daiota
提出日時 2025-04-05 01:25:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 795 bytes
コンパイル時間 1,776 ms
コンパイル使用メモリ 169,848 KB
実行使用メモリ 18,000 KB
最終ジャッジ日時 2025-04-05 01:25:11
合計ジャッジ時間 7,445 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)







vector<ll> b[100010];



int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;


	ll N;
	cin >> N;

	vector<ll> a(N);
	REP(i,N){
		ll A,B;
		cin >> A >> B;
		b[B].push_back(A);
		a[i]=A;
	}

	sort(a.begin(),a.end());

	REP(i,100005) if(b[i].size()!=0) sort(b[i].begin(),b[i].end());



	ll Q;
	cin >> Q;
	while(Q--){
		ll X,Y;
		cin >> X >> Y;


		ll x=upper_bound(a.begin(),a.end(),X)-a.begin();

		if(x==0){
			cout << 0 << endl;
			continue;
		}

		vector<ll> d=b[Y];
		ll s=0;
		if(d.size()!=0) s=upper_bound(d.begin(),d.end(),a[x-1])-lower_bound(d.begin(),d.end(),a[0]);




		cout << x-s << endl;





	}





	return 0;
}
0