結果
| 問題 | No.3085 Easy Problems |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-05 20:07:56 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,152 bytes |
| 記録 | |
| コンパイル時間 | 1,411 ms |
| コンパイル使用メモリ | 216,428 KB |
| 実行使用メモリ | 21,504 KB |
| 最終ジャッジ日時 | 2026-07-08 12:09:28 |
| 合計ジャッジ時間 | 15,389 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 17 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
#include <set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(a) a.begin(), a.end()
#define arr(a) a.rbegin(), a.rend()
using ll = long long;
//Konishii
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<vector<int>> cnt(int(1e5 + 1));
map<ll,ll> m;
rep(i, n) {
int a, b; cin >> a >> b;
cnt[b].push_back(a);
m[a]++;
}
rep(i, int(1e5+1)) {
if(cnt[i].size()) {
sort(all(cnt[i]));
}
}
m[0] = 0;
ll pre = 0;
for(auto [k, v] : m) {
m[k] += m[pre];
pre = k;
}
m[int(1e5) + 1] = m[pre];
int q; cin >> q;
rep(i, q) {
int x, y; cin >> x >> y;
auto it = m.lower_bound(x);
int mi = upper_bound(all(cnt[y]), x) - cnt[y].begin();
if(it->first == x) {
cout << m[x] - mi << "\n";
}
else {
it--;
cout << m[it->first] - mi << "\n";
}
}
}