#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<=n;a++){
int b=n;
int minima = a;
priority_queue<int,vector<int>,greater<int>>mins;
bool work = 1;
fill(ans[a],ans[a]+n+5,0);
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;
break;
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 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 |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 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 |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
87 ms |
4504 KB |
Output is correct |
14 |
Correct |
89 ms |
4432 KB |
Output is correct |
15 |
Correct |
83 ms |
4432 KB |
Output is correct |
16 |
Correct |
86 ms |
4432 KB |
Output is correct |
17 |
Correct |
83 ms |
4504 KB |
Output is correct |
18 |
Correct |
12 ms |
4512 KB |
Output is correct |
19 |
Correct |
12 ms |
4560 KB |
Output is correct |
20 |
Correct |
18 ms |
4432 KB |
Output is correct |
21 |
Correct |
55 ms |
4432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 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 |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
87 ms |
4504 KB |
Output is correct |
14 |
Correct |
89 ms |
4432 KB |
Output is correct |
15 |
Correct |
83 ms |
4432 KB |
Output is correct |
16 |
Correct |
86 ms |
4432 KB |
Output is correct |
17 |
Correct |
83 ms |
4504 KB |
Output is correct |
18 |
Correct |
12 ms |
4512 KB |
Output is correct |
19 |
Correct |
12 ms |
4560 KB |
Output is correct |
20 |
Correct |
18 ms |
4432 KB |
Output is correct |
21 |
Correct |
55 ms |
4432 KB |
Output is correct |
22 |
Correct |
104 ms |
10132 KB |
Output is correct |
23 |
Correct |
597 ms |
10824 KB |
Output is correct |
24 |
Execution timed out |
1550 ms |
7280 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
77 ms |
4432 KB |
Output is correct |
6 |
Correct |
10 ms |
4444 KB |
Output is correct |
7 |
Correct |
11 ms |
4652 KB |
Output is correct |
8 |
Correct |
306 ms |
6216 KB |
Output is correct |
9 |
Execution timed out |
1567 ms |
5360 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 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 |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
87 ms |
4504 KB |
Output is correct |
14 |
Correct |
89 ms |
4432 KB |
Output is correct |
15 |
Correct |
83 ms |
4432 KB |
Output is correct |
16 |
Correct |
86 ms |
4432 KB |
Output is correct |
17 |
Correct |
83 ms |
4504 KB |
Output is correct |
18 |
Correct |
12 ms |
4512 KB |
Output is correct |
19 |
Correct |
12 ms |
4560 KB |
Output is correct |
20 |
Correct |
18 ms |
4432 KB |
Output is correct |
21 |
Correct |
55 ms |
4432 KB |
Output is correct |
22 |
Execution timed out |
1551 ms |
101660 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 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 |
460 KB |
Output is correct |
11 |
Correct |
1 ms |
504 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
87 ms |
4504 KB |
Output is correct |
14 |
Correct |
89 ms |
4432 KB |
Output is correct |
15 |
Correct |
83 ms |
4432 KB |
Output is correct |
16 |
Correct |
86 ms |
4432 KB |
Output is correct |
17 |
Correct |
83 ms |
4504 KB |
Output is correct |
18 |
Correct |
12 ms |
4512 KB |
Output is correct |
19 |
Correct |
12 ms |
4560 KB |
Output is correct |
20 |
Correct |
18 ms |
4432 KB |
Output is correct |
21 |
Correct |
55 ms |
4432 KB |
Output is correct |
22 |
Correct |
104 ms |
10132 KB |
Output is correct |
23 |
Correct |
597 ms |
10824 KB |
Output is correct |
24 |
Execution timed out |
1550 ms |
7280 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |