結果
問題 |
No.3085 Easy Problems
|
ユーザー |
|
提出日時 | 2025-04-05 09:48:53 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 734 ms / 2,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 3,869 ms |
コンパイル使用メモリ | 285,396 KB |
実行使用メモリ | 9,716 KB |
最終ジャッジ日時 | 2025-04-05 09:49:26 |
合計ジャッジ時間 | 30,945 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; int main() { int n; cin >> n; const int M = 100005; vector<vector<int>> to(M); rep(i, n) { int a, b; cin >> a >> b; to[0].push_back(a); to[b].push_back(a); } rep(i, M) ranges::sort(to[i]); auto ub = [&](int x, int y) { return ranges::upper_bound(to[y], x) - to[y].begin(); }; int q; cin >> q; rep(qi, q) { int x, y; cin >> x >> y; int ans = ub(x, 0) - ub(x, y); cout << ans << '\n'; } return 0; }