#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];
int all = 0, sumA = 0, sumB = 0, sumAB = 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;
}
if(x[j] < a[i] && y[j] < b[i] && x[j] + y[j] >= c[i]) {
++sumAB;
}
}
cout << all - sumA - sumB + sumAB << '\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 |
43 ms |
620 KB |
Output is correct |
8 |
Correct |
43 ms |
620 KB |
Output is correct |
9 |
Correct |
44 ms |
620 KB |
Output is correct |
10 |
Correct |
49 ms |
492 KB |
Output is correct |
11 |
Correct |
52 ms |
492 KB |
Output is correct |
12 |
Correct |
43 ms |
492 KB |
Output is correct |
13 |
Correct |
46 ms |
620 KB |
Output is correct |
14 |
Correct |
46 ms |
620 KB |
Output is correct |
15 |
Correct |
55 ms |
620 KB |
Output is correct |
16 |
Correct |
24 ms |
492 KB |
Output is correct |
17 |
Correct |
43 ms |
492 KB |
Output is correct |
18 |
Correct |
11 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3053 ms |
2916 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3053 ms |
2916 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 |
43 ms |
620 KB |
Output is correct |
8 |
Correct |
43 ms |
620 KB |
Output is correct |
9 |
Correct |
44 ms |
620 KB |
Output is correct |
10 |
Correct |
49 ms |
492 KB |
Output is correct |
11 |
Correct |
52 ms |
492 KB |
Output is correct |
12 |
Correct |
43 ms |
492 KB |
Output is correct |
13 |
Correct |
46 ms |
620 KB |
Output is correct |
14 |
Correct |
46 ms |
620 KB |
Output is correct |
15 |
Correct |
55 ms |
620 KB |
Output is correct |
16 |
Correct |
24 ms |
492 KB |
Output is correct |
17 |
Correct |
43 ms |
492 KB |
Output is correct |
18 |
Correct |
11 ms |
492 KB |
Output is correct |
19 |
Execution timed out |
3053 ms |
2916 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |