結果
問題 |
No.3085 Easy Problems
|
ユーザー |
![]() |
提出日時 | 2025-05-07 12:12:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 268 ms / 2,000 ms |
コード長 | 952 bytes |
コンパイル時間 | 4,628 ms |
コンパイル使用メモリ | 293,284 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2025-05-07 12:12:58 |
合計ジャッジ時間 | 18,069 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); auto solve = [&]() { int n; cin >> n; vector<array<int, 2>> x(n); for (auto &[a, b] : x) { cin >> a >> b; } int q; cin >> q; vector<array<int, 3>> y(q); for (int i = 0; i < q; i++) { cin >> y[i][0] >> y[i][1]; y[i][2] = i; } sort(x.begin(), x.end()); sort(y.begin(), y.end()); map<int, int> cnt; vector<int> ans(q); for (int j = 0; auto [c, d, i] : y) { while (j < x.size() && x[j][0] <= c) { cnt[x[j][1]]++; j++; } ans[i] = j - cnt[d]; } for (int i = 0; i < q; i++) { cout << ans[i] << '\n'; } }; solve(); return 0; }