/*#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 |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
47 ms |
512 KB |
Output is correct |
8 |
Correct |
48 ms |
512 KB |
Output is correct |
9 |
Correct |
50 ms |
512 KB |
Output is correct |
10 |
Correct |
48 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
512 KB |
Output is correct |
12 |
Correct |
51 ms |
384 KB |
Output is correct |
13 |
Correct |
48 ms |
512 KB |
Output is correct |
14 |
Correct |
47 ms |
632 KB |
Output is correct |
15 |
Correct |
49 ms |
512 KB |
Output is correct |
16 |
Correct |
22 ms |
504 KB |
Output is correct |
17 |
Correct |
39 ms |
512 KB |
Output is correct |
18 |
Correct |
15 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3048 ms |
2616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3048 ms |
2616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
47 ms |
512 KB |
Output is correct |
8 |
Correct |
48 ms |
512 KB |
Output is correct |
9 |
Correct |
50 ms |
512 KB |
Output is correct |
10 |
Correct |
48 ms |
512 KB |
Output is correct |
11 |
Correct |
48 ms |
512 KB |
Output is correct |
12 |
Correct |
51 ms |
384 KB |
Output is correct |
13 |
Correct |
48 ms |
512 KB |
Output is correct |
14 |
Correct |
47 ms |
632 KB |
Output is correct |
15 |
Correct |
49 ms |
512 KB |
Output is correct |
16 |
Correct |
22 ms |
504 KB |
Output is correct |
17 |
Correct |
39 ms |
512 KB |
Output is correct |
18 |
Correct |
15 ms |
384 KB |
Output is correct |
19 |
Execution timed out |
3048 ms |
2616 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |