結果
問題 |
No.3085 Easy Problems
|
ユーザー |
|
提出日時 | 2025-04-05 03:04:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 226 ms / 2,000 ms |
コード長 | 678 bytes |
コンパイル時間 | 1,914 ms |
コンパイル使用メモリ | 167,804 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2025-04-05 03:05:09 |
合計ジャッジ時間 | 12,158 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define REP(i,n) for(int i=0;i<int(n);i++) vector<int> b[100010]; int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int i,j; int N; cin >> N; vector<int> a(N); REP(i,N){ int A,B; cin >> A >> B; b[B].push_back(A); a[i]=A; } sort(a.begin(),a.end()); for(i=1;i<=100000;i++) sort(b[i].begin(),b[i].end()); int Q; cin >> Q; while(Q--){ int X,Y; cin >> X >> Y; int x=upper_bound(a.begin(),a.end(),X)-a.begin(); int s=upper_bound(b[Y].begin(),b[Y].end(),X)-b[Y].begin(); cout << x-s << "\n"; } return 0; }