結果
問題 |
No.3085 Easy Problems
|
ユーザー |
|
提出日時 | 2025-04-04 22:04:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,079 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 6,780 ms |
コンパイル使用メモリ | 333,804 KB |
実行使用メモリ | 14,976 KB |
最終ジャッジ日時 | 2025-04-04 22:05:24 |
合計ジャッジ時間 | 34,587 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; int main() { int n; cin>>n; map<int,vector<int>> v; vector<int> vv(n); for(int i=0;i<n;i++){ int a,b; cin>>a>>b; vv[i]=a; v[b].push_back(a); } sort(vv.begin(),vv.end()); for(auto&[k,vec]:v){ sort(vec.begin(),vec.end()); } int q; cin>>q; while(q--){ int x,y; cin>>x>>y; cout<<((upper_bound(vv.begin(),vv.end(),x)-vv.begin())-(upper_bound(v[y].begin(),v[y].end(),x)-v[y].begin()))<<endl; } return 0; }