#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,q;
cin >> n >> m >> q;
vector<array<int,2>>events[n+1];
for(int i = 0;i<m;i++){
int a,b;
cin >> a >> b;
events[a].push_back({a,b});
events[b].push_back({a,b});
}
while(q--){
int a,b;
cin >> a >> b;
int minima = a;
priority_queue<int,vector<int>,greater<int>>mins;
bool work = 1;
for(int i = a;i<=b;i++){
for(array<int,2>a:events[i]){
if(a[0]==i)
mins.push(a[1]);
}
if(mins.size()==0){
work=false;
break;
}
minima=max(minima,mins.top());
while(mins.size()&&mins.top()==i){
mins.pop();
}
}
if(minima==b&&work){
cout << "YES\n";
}
else{
cout << "NO\n";
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
56 ms |
592 KB |
Output is correct |
14 |
Correct |
60 ms |
612 KB |
Output is correct |
15 |
Correct |
59 ms |
612 KB |
Output is correct |
16 |
Correct |
57 ms |
612 KB |
Output is correct |
17 |
Correct |
45 ms |
760 KB |
Output is correct |
18 |
Correct |
5 ms |
592 KB |
Output is correct |
19 |
Correct |
2 ms |
592 KB |
Output is correct |
20 |
Correct |
6 ms |
592 KB |
Output is correct |
21 |
Correct |
18 ms |
592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
56 ms |
592 KB |
Output is correct |
14 |
Correct |
60 ms |
612 KB |
Output is correct |
15 |
Correct |
59 ms |
612 KB |
Output is correct |
16 |
Correct |
57 ms |
612 KB |
Output is correct |
17 |
Correct |
45 ms |
760 KB |
Output is correct |
18 |
Correct |
5 ms |
592 KB |
Output is correct |
19 |
Correct |
2 ms |
592 KB |
Output is correct |
20 |
Correct |
6 ms |
592 KB |
Output is correct |
21 |
Correct |
18 ms |
592 KB |
Output is correct |
22 |
Execution timed out |
1553 ms |
2384 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
44 ms |
580 KB |
Output is correct |
6 |
Correct |
4 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Execution timed out |
1558 ms |
700 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
56 ms |
592 KB |
Output is correct |
14 |
Correct |
60 ms |
612 KB |
Output is correct |
15 |
Correct |
59 ms |
612 KB |
Output is correct |
16 |
Correct |
57 ms |
612 KB |
Output is correct |
17 |
Correct |
45 ms |
760 KB |
Output is correct |
18 |
Correct |
5 ms |
592 KB |
Output is correct |
19 |
Correct |
2 ms |
592 KB |
Output is correct |
20 |
Correct |
6 ms |
592 KB |
Output is correct |
21 |
Correct |
18 ms |
592 KB |
Output is correct |
22 |
Execution timed out |
1561 ms |
5000 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
592 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
56 ms |
592 KB |
Output is correct |
14 |
Correct |
60 ms |
612 KB |
Output is correct |
15 |
Correct |
59 ms |
612 KB |
Output is correct |
16 |
Correct |
57 ms |
612 KB |
Output is correct |
17 |
Correct |
45 ms |
760 KB |
Output is correct |
18 |
Correct |
5 ms |
592 KB |
Output is correct |
19 |
Correct |
2 ms |
592 KB |
Output is correct |
20 |
Correct |
6 ms |
592 KB |
Output is correct |
21 |
Correct |
18 ms |
592 KB |
Output is correct |
22 |
Execution timed out |
1553 ms |
2384 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |