結果
| 問題 |
No.3085 Easy Problems
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-04 21:24:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 227 ms / 2,000 ms |
| コード長 | 704 bytes |
| コンパイル時間 | 2,682 ms |
| コンパイル使用メモリ | 198,728 KB |
| 実行使用メモリ | 9,620 KB |
| 最終ジャッジ日時 | 2025-04-04 21:24:54 |
| 合計ジャッジ時間 | 11,624 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
int n = 100000;
vector<vector<int>> P(n);
vector<int> all;
for(int i=0; i<N; i++){
int a,b; cin >> a >> b; b--;
P.at(b).push_back(a);
all.push_back(a);
}
for(auto &p : P) sort(p.begin(),p.end());
sort(all.begin(),all.end());
int Q; cin >> Q;
while(Q--){
int x,y; cin >> x >> y; y--;
int answer = 0;
answer = upper_bound(all.begin(),all.end(),x)-all.begin();
answer -= upper_bound(P.at(y).begin(),P.at(y).end(),x)-P.at(y).begin();
cout << answer << "\n";
}
}