问题描述
- #include<bits/stdc++.h>
- using namespace std;
- int d[200100] = { 0 };
- int main() {
- int n, m, k,time,e,l,last;
- cin >> n >> m >> k;
- for (int i = 0; i < n; i++)
- {
- cin >> l>>e;
- if (l > k) {
- d[max(k + 1, l - e + 1)]++;
- d[l + 1]--;
- last = max(last, l);
- }
- }
- for (int i = k+1; i <= last+1; i++)
- {
- d[i] += d[i - 1];
- }
- while (m--)
- {
- cin >> time;
- time += k;
- cout << d[time] << endl;
- }
-
- return 0;
- }