Submission #273848

#TimeUsernameProblemLanguageResultExecution timeMemory
273848MKutayBozkurtExamination (JOI19_examination)C++14
2 / 100
3048 ms2616 KiB
/*#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...