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>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, q;
cin >> n >> q;
vector<pair<int, pair<int, int>>> A(n), B(n), C(n);
for (int i = 0; i < n; i++) {
cin >> A[i].first >> A[i].second.first;
A[i].second.second = A[i].first + A[i].second.first;
B[i].first = A[i].second.first;
B[i].second.first = A[i].first;
B[i].second.second = A[i].second.second;
C[i].first = A[i].second.second;
C[i].second.first = A[i].first;
C[i].second.second = A[i].second.first;
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
sort(C.begin(), C.end());
vector<int> a(n), b(n), c(n);
for (int i = 0; i < n; i++) {
a[i] = A[i].first;
b[i] = B[i].first;
c[i] = C[i].first;
}
while (q--) {
int x, y, z;
cin >> x >> y >> z;
int i1 = a.end() - lower_bound(a.begin(), a.end(), x);
int i2 = b.end() - lower_bound(b.begin(), b.end(), y);
int i3 = c.end() - lower_bound(c.begin(), c.end(), z);
cout << min({i1, i2, i3}) << '\n';
}
return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, q;
cin >> n >> q;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i].first >> a[i].second;
}
while (q--) {
int x, y, z;
cin >> x >> y >> z;
int ans = 0;
for (int i = 0; i < n; i++) {
if (a[i].first >= x && a[i].second >= y && a[i].first + a[i].second >= z) ans++;
}
cout << ans << '\n';
}
return 0;
}
# | 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... |