結果
| 問題 |
No.3085 Easy Problems
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-22 17:18:39 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 519 ms / 2,000 ms |
| コード長 | 1,349 bytes |
| コンパイル時間 | 6,802 ms |
| コンパイル使用メモリ | 335,464 KB |
| 実行使用メモリ | 9,472 KB |
| 最終ジャッジ日時 | 2025-06-22 17:19:08 |
| 合計ジャッジ時間 | 28,807 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define NP next_permutation
const int INF32 = 2e9;
const ll INF64 = 2e18;
const ll mod = 998244353;
// const ll mod = 1e9 + 7;
template<typename T> bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
void cincout() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
}
int main() {
cincout();
int N;
cin >> N;
vector<vector<int>> a(1e5);
vector<int> all_A(N);
for (int i = 0; i < N; i++) {
int A, B;
cin >> A >> B;
B--;
a[B].push_back(A);
all_A[i] = A;
}
sort(all(all_A));
for (int i = 0; i < 1e5; i++) sort(all(a[i]));
int Q;
cin >> Q;
while (Q--) {
int X, Y;
cin >> X >> Y;
Y--;
int ans = upper_bound(all(all_A), X) - all_A.begin();
ans -= upper_bound(all(a[Y]), X) - a[Y].begin();
cout << ans << endl;
}
}