結果
問題 |
No.3085 Easy Problems
|
ユーザー |
👑 ![]() |
提出日時 | 2025-04-04 21:25:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 1,054 bytes |
コンパイル時間 | 1,843 ms |
コンパイル使用メモリ | 80,640 KB |
実行使用メモリ | 10,640 KB |
最終ジャッジ日時 | 2025-04-04 21:26:43 |
合計ジャッジ時間 | 12,105 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include <iostream> #include <string> #include <vector> #include <algorithm> using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(i64 i=0; i<i64(n); i++) const i64 INF = 1001001001001001001; template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; } template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; i64 lbi(vector<i64>& a, i64 x){ return lower_bound(a.begin(), a.end(), x) - a.begin(); } void testcase(){ i64 N; cin >> N; vector<i64> F; vector<vector<i64>> A(100001); rep(i,N){ i64 a,b; cin >> a >> b; F.push_back(a); A[b].push_back(a); } sort(F.begin(), F.end()); for(auto& f : A) sort(f.begin(), f.end()); i64 Q; cin >> Q; rep(qi,Q){ i64 x,y; cin >> x >> y; i64 ans = lbi(F,x+1) - lbi(A[y],x+1); cout << ans << "\n"; } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }