結果
問題 |
No.3085 Easy Problems
|
ユーザー |
![]() |
提出日時 | 2025-04-04 22:00:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 435 ms / 2,000 ms |
コード長 | 867 bytes |
コンパイル時間 | 3,513 ms |
コンパイル使用メモリ | 285,532 KB |
実行使用メモリ | 13,824 KB |
最終ジャッジ日時 | 2025-04-04 22:01:07 |
合計ジャッジ時間 | 18,460 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long #define mod 1000000007 int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); int N,Q; pair<ll,ll> AB[200009]; cin>>N; for(int i=1;i<=N;i++) cin>>AB[i].first>>AB[i].second; sort(AB+1,AB+N+1); cin>>Q; tuple<ll,ll,ll>xy[200009]; for(int i=1;i<=Q;i++){ cin>>get<0>(xy[i])>>get<1>(xy[i]); get<2>(xy[i])=i; } sort(xy+1,xy+Q+1); ll ans[200009]; ll ng[100009]; for(int i=1;i<=100000;i++) ng[i]=0; ll pos=1; AB[N+1]={2e18,2e18}; for(int i=1;i<=Q;i++){ while(AB[pos].first<=get<0>(xy[i])){ ng[AB[pos].second]++; pos++; } ans[get<2>(xy[i])]=pos-ng[get<1>(xy[i])]-1; } for(int i=1;i<=Q;i++) cout<<ans[i]<<endl; }