結果
問題 |
No.3085 Easy Problems
|
ユーザー |
![]() |
提出日時 | 2025-06-19 00:34:15 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 216 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 4,540 ms |
コンパイル使用メモリ | 287,192 KB |
実行使用メモリ | 11,180 KB |
最終ジャッジ日時 | 2025-06-19 00:34:34 |
合計ジャッジ時間 | 18,504 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<pair<int, int>> v(n); rep(i, n) cin >> v[i].first >> v[i].second; vector cnt(1e5 + 1, vector<int>()); vector<int> ps; for (auto [a, b] : v) { cnt[b].push_back(a); ps.push_back(a); } sort(ps.begin(), ps.end()); for (auto&& c : cnt) sort(c.begin(), c.end()); int q; cin >> q; while (q--) { int x, y; cin >> x >> y; auto idx1 = upper_bound(ps.begin(), ps.end(), x) - ps.begin(); auto idx2 = upper_bound(cnt[y].begin(), cnt[y].end(), x) - cnt[y].begin(); assert(idx1 >= idx2); cout << idx1 - idx2 << '\n'; } return 0; }