#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});
}
bool ans[n+5][n+5];
for(int a = 1;a<=1;a++){
int b=n;
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]){
mins.push(a[1]);
}
if(mins.size())
minima=max(minima,mins.top());
if(mins.size()==0){
work=0;
}
if(minima==i&&work){
ans[a][i]=1;
}
else{
ans[a][i]=0;
}
while(mins.size()&&mins.top()==i){
mins.pop();
}
}
}
while(q--){
int a,b;
cin >> a >> b;
cout << (ans[a][b] ? "YES\n" : "NO\n");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
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 |
4 ms |
4432 KB |
Output is correct |
6 |
Correct |
5 ms |
4276 KB |
Output is correct |
7 |
Correct |
4 ms |
4432 KB |
Output is correct |
8 |
Correct |
55 ms |
6312 KB |
Output is correct |
9 |
Correct |
61 ms |
10000 KB |
Output is correct |
10 |
Correct |
161 ms |
20200 KB |
Output is correct |
11 |
Correct |
54 ms |
9604 KB |
Output is correct |
12 |
Runtime error |
884 ms |
1048576 KB |
Execution killed with signal 9 |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |