結果
問題 |
No.3085 Easy Problems
|
ユーザー |
![]() |
提出日時 | 2025-04-04 21:28:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 233 ms / 2,000 ms |
コード長 | 1,151 bytes |
コンパイル時間 | 7,064 ms |
コンパイル使用メモリ | 332,464 KB |
実行使用メモリ | 9,616 KB |
最終ジャッジ日時 | 2025-04-04 21:30:27 |
合計ジャッジ時間 | 16,534 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; template <typename T> int smaller(vector<T> &a, T x) { return lower_bound(a.begin(), a.end(), x) - a.begin(); } template <typename T> int or_smaller(vector<T> &a, T x) { return upper_bound(a.begin(), a.end(), x) - a.begin(); } template <typename T> int bigger(vector<T> &a, T x) { return a.size() - or_smaller(a, x); } template <typename T> int or_bigger(vector<T> &a, T x) { return a.size() - smaller(a, x); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<vector<int>> v(100010); vector<int> w; rep(i, 0, n) { int a, b; cin >> a >> b; v[b].push_back(a); w.push_back(a); } rep(i, 0, 100010) { sort(v[i].begin(), v[i].end()); } sort(w.begin(), w.end()); int q; cin >> q; while (q--) { int x, y; cin >> x >> y; int ans = or_smaller(w, x); ans -= or_smaller(v[y], x); cout << ans << '\n'; } }