#include <bits/stdc++.h>
using namespace std;
int main () {
int n;
cin >> n;
pair <int, int> arr[n + 1];
for (int i = 1; i <= n; i++) cin >> arr[i].first >> arr[i].second;
int q;
cin >> q;
while (q--) {
int l, r;
cin >> l >> r;
map <int, int> x;
for (int i = l; i <= r; i++) {
x[arr[i].first]++;
x[arr[i].second + 1]--;
}
int cur = 0;
int mx = 0;
for (auto i : x) {
cur += i.second;
mx = max(mx, cur);
}
cout << mx << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
23380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
1044 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
1044 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1055 ms |
21804 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
23380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |