#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+10;
int x[N], y[N], a[N], b[N], c[N];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> y[i];
}
for (int i = 1; i <= m; ++i) {
cin >> a[i] >> b[i] >> c[i];
if(a[i] + b[i] >= c[i]) {
int ans = 0;
for(int j = 1; j <= n; ++j) {
if(x[j] >= a[i] && y[j] >= b[i]) {
++ans;
}
}
cout << ans << '\n';
continue;
}
int all = 0, sumA = 0, sumB = 0;
for(int j = 1; j <= n; ++j) {
if(x[j] + y[j] >= c[i]) {
++all;
}
if(x[j] < a[i] && x[j] + y[j] >= c[i]) {
++sumA;
}
if(y[j] < b[i] && x[j] + y[j] >= c[i]) {
++sumB;
}
}
cout << all - sumA - sumB << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
41 ms |
492 KB |
Output is correct |
8 |
Correct |
41 ms |
492 KB |
Output is correct |
9 |
Correct |
45 ms |
492 KB |
Output is correct |
10 |
Correct |
42 ms |
492 KB |
Output is correct |
11 |
Correct |
44 ms |
492 KB |
Output is correct |
12 |
Correct |
41 ms |
492 KB |
Output is correct |
13 |
Correct |
50 ms |
620 KB |
Output is correct |
14 |
Correct |
48 ms |
464 KB |
Output is correct |
15 |
Correct |
48 ms |
492 KB |
Output is correct |
16 |
Correct |
30 ms |
492 KB |
Output is correct |
17 |
Correct |
36 ms |
492 KB |
Output is correct |
18 |
Correct |
13 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3043 ms |
1664 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3043 ms |
1664 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
41 ms |
492 KB |
Output is correct |
8 |
Correct |
41 ms |
492 KB |
Output is correct |
9 |
Correct |
45 ms |
492 KB |
Output is correct |
10 |
Correct |
42 ms |
492 KB |
Output is correct |
11 |
Correct |
44 ms |
492 KB |
Output is correct |
12 |
Correct |
41 ms |
492 KB |
Output is correct |
13 |
Correct |
50 ms |
620 KB |
Output is correct |
14 |
Correct |
48 ms |
464 KB |
Output is correct |
15 |
Correct |
48 ms |
492 KB |
Output is correct |
16 |
Correct |
30 ms |
492 KB |
Output is correct |
17 |
Correct |
36 ms |
492 KB |
Output is correct |
18 |
Correct |
13 ms |
492 KB |
Output is correct |
19 |
Execution timed out |
3043 ms |
1664 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |