This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
//#define int long long int
#define ld long double
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define ppii pair<ii,int>
#define pll pair<ll,ll>
#define vv vector
#define endl '\n'
using namespace std;
void solve(){
int n , q; cin >> n >> q;
int s[n],t[n];
FOR(i,n){
cin >> s[i] >> t[i];
}
int x[q],y[q],z[q];
FOR (i,q) {
cin >> x[i] >> y[i] >> z[i];
}
// int j = 0;
// int a= 0,b= 0,c= 0;
FOR(j,q){
int ans = 0;
FOR(i,n){
if(s[i]+t[i] >= z[j] && s[i] >= x[j] && t[i] >= y[j]) {
ans++;
//cout << "i= " << i << endl;
}
}
cout << ans << endl;
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
while (t--){
solve();
}
}
// template by rajarshi basu
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |