#include<iostream>
#include<cstring>
using namespace std;
const int maxn = (int)1e5 + 7;
long long D[maxn];
int main()
{
int n;
while (cin >> n&&n)
{
int m;
cin >> m;
memset(D, 0, sizeof(D));
int l, r, v;
for (int i = 0; i < m; i++)
{
scanf("%d%d%d", &l, &r, &v);
D[l] += v;
D[r+1] -= v;
}
long long p = 0;
for (int i = 0; i <= n; i++)
{
D[i] += D[i - 1];
}
D[n + 1] = 0;
for (int i = n; i >= 0; i--)
{
D[i] = D[i + 1] + D[i];
}
int ans = 0;
int k;
cin >> k;
for (int i = 0; i < k; i++)
{
int x;
long long h;
scanf("%I64d%d", &h, &x);
if (D[x] < h)
ans++;
}
cout << ans << endl;
}
return 0;
}
区间覆盖
最新推荐文章于 2024-01-24 16:08:59 发布