結果
| 問題 |
No.3085 Easy Problems
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-04 21:23:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 261 ms / 2,000 ms |
| コード長 | 557 bytes |
| コンパイル時間 | 663 ms |
| コンパイル使用メモリ | 72,672 KB |
| 実行使用メモリ | 10,348 KB |
| 最終ジャッジ日時 | 2025-04-04 21:24:02 |
| 合計ジャッジ時間 | 10,844 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
int N,Q;
vector<int>A[1<<17],AA;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
for(int i=0;i<N;i++)
{
int a,b;cin>>a>>b;
A[b].push_back(a);
AA.push_back(a);
}
for(int b=1;b<=1e5;b++)sort(A[b].begin(),A[b].end());
sort(AA.begin(),AA.end());
cin>>Q;
for(;Q--;)
{
int X,Y;cin>>X>>Y;
int ans=upper_bound(AA.begin(),AA.end(),X)-AA.begin();
ans-=upper_bound(A[Y].begin(),A[Y].end(),X)-A[Y].begin();
cout<<ans<<"\n";
}
}