結果
問題 |
No.3085 Easy Problems
|
ユーザー |
|
提出日時 | 2025-04-04 23:22:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 879 bytes |
コンパイル時間 | 1,945 ms |
コンパイル使用メモリ | 180,448 KB |
実行使用メモリ | 20,412 KB |
最終ジャッジ日時 | 2025-04-04 23:22:57 |
合計ジャッジ時間 | 7,179 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 30 |
ソースコード
#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++) int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j; ll N; cin >> N; map<ll,vector<ll>> m; vector<P> e(N); for(i=0;i<N;i++){ ll A,B; cin >> A >> B; e[i].first=A; e[i].second=B; } sort(e.begin(),e.end()); REP(i,N) m[e[i].second].push_back(e[i].first); vector<ll> a(N); REP(i,N) a[i]=e[i].first; sort(a.begin(),a.end()); ll Q; cin >> Q; vector<ll> b(N,0); 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; } ll ans=x; vector<ll> d=m[Y]; ll s=upper_bound(d.begin(),d.end(),a[x-1])-lower_bound(d.begin(),d.end(),a[0]); ans-=s; cout << ans << endl; } return 0; }