#include <iostream>
#include <vector>
#include <array>
using namespace std;
using ll = long long;
int n, q;
vector <pair <ll, ll>> ppl;
vector <array <ll, 3>> queries;
void subtask1() {
for (int i = 0; i < q; i++) {
int ans = 0;
ll a = queries[i][0], b = queries[i][1], c = queries[i][2];
for (int j = 0; j < n; j++) {
if (ppl[j].first + ppl[j].second >= c && ppl[j].first >= a && ppl[j].second >= b)
ans++;
}
cout << ans << '\n';
}
}
int main() {
cin >> n >> q;
ppl.resize(n);
queries.resize(q);
for (int i = 0; i < n; i++)
cin >> ppl[i].first >> ppl[i].second;
for (int i = 0; i < q; i++)
cin >> queries[i][0] >> queries[i][1] >> queries[i][2];
if (n <= 3000 && q <= 3000)
subtask1();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
27 ms |
692 KB |
Output is correct |
8 |
Correct |
32 ms |
616 KB |
Output is correct |
9 |
Correct |
27 ms |
604 KB |
Output is correct |
10 |
Correct |
27 ms |
644 KB |
Output is correct |
11 |
Correct |
27 ms |
604 KB |
Output is correct |
12 |
Correct |
26 ms |
584 KB |
Output is correct |
13 |
Correct |
28 ms |
680 KB |
Output is correct |
14 |
Correct |
27 ms |
604 KB |
Output is correct |
15 |
Correct |
27 ms |
680 KB |
Output is correct |
16 |
Correct |
19 ms |
604 KB |
Output is correct |
17 |
Correct |
20 ms |
604 KB |
Output is correct |
18 |
Correct |
9 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
87 ms |
6852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
87 ms |
6852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
27 ms |
692 KB |
Output is correct |
8 |
Correct |
32 ms |
616 KB |
Output is correct |
9 |
Correct |
27 ms |
604 KB |
Output is correct |
10 |
Correct |
27 ms |
644 KB |
Output is correct |
11 |
Correct |
27 ms |
604 KB |
Output is correct |
12 |
Correct |
26 ms |
584 KB |
Output is correct |
13 |
Correct |
28 ms |
680 KB |
Output is correct |
14 |
Correct |
27 ms |
604 KB |
Output is correct |
15 |
Correct |
27 ms |
680 KB |
Output is correct |
16 |
Correct |
19 ms |
604 KB |
Output is correct |
17 |
Correct |
20 ms |
604 KB |
Output is correct |
18 |
Correct |
9 ms |
344 KB |
Output is correct |
19 |
Incorrect |
87 ms |
6852 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |