#include<bits/stdc++.h>
using namespace std;
long long n, q, x, y, cnt = 0;
pair<int, int> a[200001];
bool check[200001];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n;
for(int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second;
sort(a + 1, a + n + 1);
cin >> q;
while(q--)
{
cin >> x >> y;
for(int i = x; i <= y; ++i)
{
if(check[i]) continue;
pair<int, int> temp = a[i];
for(int j = i + 1; j <= y; ++j)
{
if(a[j].first > temp.second)
{
temp = a[j];
check[j] = true;
}
}
++cnt;
}
cout << cnt << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1085 ms |
1956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
356 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
356 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
1876 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1085 ms |
1956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |