# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1102872 |
2024-10-19T05:56:10 Z |
ttamx |
Curtains (NOI23_curtains) |
C++17 |
|
763 ms |
72828 KB |
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
const int K=1<<20;
const int INF=INT_MAX/2;
int n,m,q;
vector<int> upd[N];
vector<pair<int,int>> qrs[N];
bool ans[N];
struct SegTree{
int t[K],lz[K];
void apply(int i,int v){
t[i]=max(t[i],v);
lz[i]=max(lz[i],v);
}
void push(int i){
apply(i*2,lz[i]);
apply(i*2+1,lz[i]);
lz[i]=0;
}
void update(int l,int r,int i,int x,int y,int v){
if(y<l||r<x)return;
if(x<=l&&r<=y)return apply(i,v);
push(i);
int m=(l+r)/2;
update(l,m,i*2,x,y,v);
update(m+1,r,i*2+1,x,y,v);
t[i]=min(t[i*2],t[i*2+1]);
}
void update(int x,int y,int v){
update(1,n,1,x,y,v);
}
int query(int l,int r,int i,int x,int y){
if(y<l||r<x)return INF;
if(x<=l&&r<=y)return t[i];
push(i);
int m=(l+r)/2;
return min(query(l,m,i*2,x,y),query(m+1,r,i*2+1,x,y));
}
int query(int x,int y){
return query(1,n,1,x,y);
}
}seg;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> m >> q;
for(int i=0;i<m;i++){
int l,r;
cin >> l >> r;
upd[r].emplace_back(l);
}
for(int i=0;i<q;i++){
int l,r;
cin >> l >> r;
qrs[r].emplace_back(l,i);
}
for(int r=1;r<=n;r++){
for(auto l:upd[r]){
seg.update(l,r,l);
}
for(auto [l,i]:qrs[r]){
ans[i]=(seg.query(l,r)>=l);
}
}
for(int i=0;i<q;i++){
cout << (ans[i]?"YES":"NO") << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
26192 KB |
Output is correct |
2 |
Correct |
5 ms |
26292 KB |
Output is correct |
3 |
Correct |
6 ms |
26192 KB |
Output is correct |
4 |
Correct |
5 ms |
26192 KB |
Output is correct |
5 |
Correct |
6 ms |
26208 KB |
Output is correct |
6 |
Correct |
5 ms |
26192 KB |
Output is correct |
7 |
Correct |
5 ms |
26192 KB |
Output is correct |
8 |
Correct |
5 ms |
26192 KB |
Output is correct |
9 |
Correct |
5 ms |
26192 KB |
Output is correct |
10 |
Correct |
5 ms |
26192 KB |
Output is correct |
11 |
Correct |
5 ms |
26192 KB |
Output is correct |
12 |
Correct |
5 ms |
26192 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
26192 KB |
Output is correct |
2 |
Correct |
5 ms |
26292 KB |
Output is correct |
3 |
Correct |
6 ms |
26192 KB |
Output is correct |
4 |
Correct |
5 ms |
26192 KB |
Output is correct |
5 |
Correct |
6 ms |
26208 KB |
Output is correct |
6 |
Correct |
5 ms |
26192 KB |
Output is correct |
7 |
Correct |
5 ms |
26192 KB |
Output is correct |
8 |
Correct |
5 ms |
26192 KB |
Output is correct |
9 |
Correct |
5 ms |
26192 KB |
Output is correct |
10 |
Correct |
5 ms |
26192 KB |
Output is correct |
11 |
Correct |
5 ms |
26192 KB |
Output is correct |
12 |
Correct |
5 ms |
26192 KB |
Output is correct |
13 |
Correct |
7 ms |
26448 KB |
Output is correct |
14 |
Correct |
6 ms |
26448 KB |
Output is correct |
15 |
Correct |
6 ms |
26448 KB |
Output is correct |
16 |
Correct |
8 ms |
26448 KB |
Output is correct |
17 |
Correct |
6 ms |
26448 KB |
Output is correct |
18 |
Correct |
6 ms |
26464 KB |
Output is correct |
19 |
Correct |
6 ms |
26448 KB |
Output is correct |
20 |
Correct |
6 ms |
26448 KB |
Output is correct |
21 |
Correct |
8 ms |
26448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
26192 KB |
Output is correct |
2 |
Correct |
5 ms |
26292 KB |
Output is correct |
3 |
Correct |
6 ms |
26192 KB |
Output is correct |
4 |
Correct |
5 ms |
26192 KB |
Output is correct |
5 |
Correct |
6 ms |
26208 KB |
Output is correct |
6 |
Correct |
5 ms |
26192 KB |
Output is correct |
7 |
Correct |
5 ms |
26192 KB |
Output is correct |
8 |
Correct |
5 ms |
26192 KB |
Output is correct |
9 |
Correct |
5 ms |
26192 KB |
Output is correct |
10 |
Correct |
5 ms |
26192 KB |
Output is correct |
11 |
Correct |
5 ms |
26192 KB |
Output is correct |
12 |
Correct |
5 ms |
26192 KB |
Output is correct |
13 |
Correct |
7 ms |
26448 KB |
Output is correct |
14 |
Correct |
6 ms |
26448 KB |
Output is correct |
15 |
Correct |
6 ms |
26448 KB |
Output is correct |
16 |
Correct |
8 ms |
26448 KB |
Output is correct |
17 |
Correct |
6 ms |
26448 KB |
Output is correct |
18 |
Correct |
6 ms |
26464 KB |
Output is correct |
19 |
Correct |
6 ms |
26448 KB |
Output is correct |
20 |
Correct |
6 ms |
26448 KB |
Output is correct |
21 |
Correct |
8 ms |
26448 KB |
Output is correct |
22 |
Correct |
160 ms |
38216 KB |
Output is correct |
23 |
Correct |
155 ms |
38728 KB |
Output is correct |
24 |
Correct |
183 ms |
40104 KB |
Output is correct |
25 |
Correct |
298 ms |
45184 KB |
Output is correct |
26 |
Correct |
140 ms |
38728 KB |
Output is correct |
27 |
Correct |
276 ms |
45896 KB |
Output is correct |
28 |
Correct |
285 ms |
45656 KB |
Output is correct |
29 |
Correct |
155 ms |
37448 KB |
Output is correct |
30 |
Correct |
98 ms |
37704 KB |
Output is correct |
31 |
Correct |
107 ms |
38480 KB |
Output is correct |
32 |
Correct |
245 ms |
45016 KB |
Output is correct |
33 |
Correct |
96 ms |
37704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
26192 KB |
Output is correct |
2 |
Correct |
6 ms |
26192 KB |
Output is correct |
3 |
Correct |
5 ms |
26204 KB |
Output is correct |
4 |
Correct |
6 ms |
26192 KB |
Output is correct |
5 |
Correct |
8 ms |
26448 KB |
Output is correct |
6 |
Correct |
8 ms |
26480 KB |
Output is correct |
7 |
Correct |
7 ms |
26448 KB |
Output is correct |
8 |
Correct |
102 ms |
36424 KB |
Output is correct |
9 |
Correct |
113 ms |
34980 KB |
Output is correct |
10 |
Correct |
245 ms |
41688 KB |
Output is correct |
11 |
Correct |
104 ms |
37716 KB |
Output is correct |
12 |
Correct |
90 ms |
35400 KB |
Output is correct |
13 |
Correct |
109 ms |
35400 KB |
Output is correct |
14 |
Correct |
71 ms |
35656 KB |
Output is correct |
15 |
Correct |
75 ms |
35148 KB |
Output is correct |
16 |
Correct |
91 ms |
35476 KB |
Output is correct |
17 |
Correct |
81 ms |
35144 KB |
Output is correct |
18 |
Correct |
700 ms |
69456 KB |
Output is correct |
19 |
Correct |
560 ms |
69704 KB |
Output is correct |
20 |
Correct |
456 ms |
70172 KB |
Output is correct |
21 |
Correct |
497 ms |
69584 KB |
Output is correct |
22 |
Correct |
508 ms |
67808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
26192 KB |
Output is correct |
2 |
Correct |
5 ms |
26292 KB |
Output is correct |
3 |
Correct |
6 ms |
26192 KB |
Output is correct |
4 |
Correct |
5 ms |
26192 KB |
Output is correct |
5 |
Correct |
6 ms |
26208 KB |
Output is correct |
6 |
Correct |
5 ms |
26192 KB |
Output is correct |
7 |
Correct |
5 ms |
26192 KB |
Output is correct |
8 |
Correct |
5 ms |
26192 KB |
Output is correct |
9 |
Correct |
5 ms |
26192 KB |
Output is correct |
10 |
Correct |
5 ms |
26192 KB |
Output is correct |
11 |
Correct |
5 ms |
26192 KB |
Output is correct |
12 |
Correct |
5 ms |
26192 KB |
Output is correct |
13 |
Correct |
7 ms |
26448 KB |
Output is correct |
14 |
Correct |
6 ms |
26448 KB |
Output is correct |
15 |
Correct |
6 ms |
26448 KB |
Output is correct |
16 |
Correct |
8 ms |
26448 KB |
Output is correct |
17 |
Correct |
6 ms |
26448 KB |
Output is correct |
18 |
Correct |
6 ms |
26464 KB |
Output is correct |
19 |
Correct |
6 ms |
26448 KB |
Output is correct |
20 |
Correct |
6 ms |
26448 KB |
Output is correct |
21 |
Correct |
8 ms |
26448 KB |
Output is correct |
22 |
Correct |
79 ms |
30840 KB |
Output is correct |
23 |
Correct |
76 ms |
31048 KB |
Output is correct |
24 |
Correct |
106 ms |
34632 KB |
Output is correct |
25 |
Correct |
122 ms |
34740 KB |
Output is correct |
26 |
Correct |
102 ms |
35912 KB |
Output is correct |
27 |
Correct |
100 ms |
35912 KB |
Output is correct |
28 |
Correct |
84 ms |
33864 KB |
Output is correct |
29 |
Correct |
106 ms |
35612 KB |
Output is correct |
30 |
Correct |
134 ms |
34632 KB |
Output is correct |
31 |
Correct |
125 ms |
34632 KB |
Output is correct |
32 |
Correct |
112 ms |
35312 KB |
Output is correct |
33 |
Correct |
103 ms |
35404 KB |
Output is correct |
34 |
Correct |
100 ms |
34120 KB |
Output is correct |
35 |
Correct |
118 ms |
34376 KB |
Output is correct |
36 |
Correct |
98 ms |
34924 KB |
Output is correct |
37 |
Correct |
114 ms |
35400 KB |
Output is correct |
38 |
Correct |
101 ms |
35480 KB |
Output is correct |
39 |
Correct |
84 ms |
35656 KB |
Output is correct |
40 |
Correct |
87 ms |
35248 KB |
Output is correct |
41 |
Correct |
76 ms |
35400 KB |
Output is correct |
42 |
Correct |
83 ms |
35080 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
26192 KB |
Output is correct |
2 |
Correct |
5 ms |
26292 KB |
Output is correct |
3 |
Correct |
6 ms |
26192 KB |
Output is correct |
4 |
Correct |
5 ms |
26192 KB |
Output is correct |
5 |
Correct |
6 ms |
26208 KB |
Output is correct |
6 |
Correct |
5 ms |
26192 KB |
Output is correct |
7 |
Correct |
5 ms |
26192 KB |
Output is correct |
8 |
Correct |
5 ms |
26192 KB |
Output is correct |
9 |
Correct |
5 ms |
26192 KB |
Output is correct |
10 |
Correct |
5 ms |
26192 KB |
Output is correct |
11 |
Correct |
5 ms |
26192 KB |
Output is correct |
12 |
Correct |
5 ms |
26192 KB |
Output is correct |
13 |
Correct |
7 ms |
26448 KB |
Output is correct |
14 |
Correct |
6 ms |
26448 KB |
Output is correct |
15 |
Correct |
6 ms |
26448 KB |
Output is correct |
16 |
Correct |
8 ms |
26448 KB |
Output is correct |
17 |
Correct |
6 ms |
26448 KB |
Output is correct |
18 |
Correct |
6 ms |
26464 KB |
Output is correct |
19 |
Correct |
6 ms |
26448 KB |
Output is correct |
20 |
Correct |
6 ms |
26448 KB |
Output is correct |
21 |
Correct |
8 ms |
26448 KB |
Output is correct |
22 |
Correct |
160 ms |
38216 KB |
Output is correct |
23 |
Correct |
155 ms |
38728 KB |
Output is correct |
24 |
Correct |
183 ms |
40104 KB |
Output is correct |
25 |
Correct |
298 ms |
45184 KB |
Output is correct |
26 |
Correct |
140 ms |
38728 KB |
Output is correct |
27 |
Correct |
276 ms |
45896 KB |
Output is correct |
28 |
Correct |
285 ms |
45656 KB |
Output is correct |
29 |
Correct |
155 ms |
37448 KB |
Output is correct |
30 |
Correct |
98 ms |
37704 KB |
Output is correct |
31 |
Correct |
107 ms |
38480 KB |
Output is correct |
32 |
Correct |
245 ms |
45016 KB |
Output is correct |
33 |
Correct |
96 ms |
37704 KB |
Output is correct |
34 |
Correct |
6 ms |
26192 KB |
Output is correct |
35 |
Correct |
6 ms |
26192 KB |
Output is correct |
36 |
Correct |
5 ms |
26204 KB |
Output is correct |
37 |
Correct |
6 ms |
26192 KB |
Output is correct |
38 |
Correct |
8 ms |
26448 KB |
Output is correct |
39 |
Correct |
8 ms |
26480 KB |
Output is correct |
40 |
Correct |
7 ms |
26448 KB |
Output is correct |
41 |
Correct |
102 ms |
36424 KB |
Output is correct |
42 |
Correct |
113 ms |
34980 KB |
Output is correct |
43 |
Correct |
245 ms |
41688 KB |
Output is correct |
44 |
Correct |
104 ms |
37716 KB |
Output is correct |
45 |
Correct |
90 ms |
35400 KB |
Output is correct |
46 |
Correct |
109 ms |
35400 KB |
Output is correct |
47 |
Correct |
71 ms |
35656 KB |
Output is correct |
48 |
Correct |
75 ms |
35148 KB |
Output is correct |
49 |
Correct |
91 ms |
35476 KB |
Output is correct |
50 |
Correct |
81 ms |
35144 KB |
Output is correct |
51 |
Correct |
700 ms |
69456 KB |
Output is correct |
52 |
Correct |
560 ms |
69704 KB |
Output is correct |
53 |
Correct |
456 ms |
70172 KB |
Output is correct |
54 |
Correct |
497 ms |
69584 KB |
Output is correct |
55 |
Correct |
508 ms |
67808 KB |
Output is correct |
56 |
Correct |
79 ms |
30840 KB |
Output is correct |
57 |
Correct |
76 ms |
31048 KB |
Output is correct |
58 |
Correct |
106 ms |
34632 KB |
Output is correct |
59 |
Correct |
122 ms |
34740 KB |
Output is correct |
60 |
Correct |
102 ms |
35912 KB |
Output is correct |
61 |
Correct |
100 ms |
35912 KB |
Output is correct |
62 |
Correct |
84 ms |
33864 KB |
Output is correct |
63 |
Correct |
106 ms |
35612 KB |
Output is correct |
64 |
Correct |
134 ms |
34632 KB |
Output is correct |
65 |
Correct |
125 ms |
34632 KB |
Output is correct |
66 |
Correct |
112 ms |
35312 KB |
Output is correct |
67 |
Correct |
103 ms |
35404 KB |
Output is correct |
68 |
Correct |
100 ms |
34120 KB |
Output is correct |
69 |
Correct |
118 ms |
34376 KB |
Output is correct |
70 |
Correct |
98 ms |
34924 KB |
Output is correct |
71 |
Correct |
114 ms |
35400 KB |
Output is correct |
72 |
Correct |
101 ms |
35480 KB |
Output is correct |
73 |
Correct |
84 ms |
35656 KB |
Output is correct |
74 |
Correct |
87 ms |
35248 KB |
Output is correct |
75 |
Correct |
76 ms |
35400 KB |
Output is correct |
76 |
Correct |
83 ms |
35080 KB |
Output is correct |
77 |
Correct |
763 ms |
65864 KB |
Output is correct |
78 |
Correct |
707 ms |
65076 KB |
Output is correct |
79 |
Correct |
639 ms |
72664 KB |
Output is correct |
80 |
Correct |
592 ms |
72828 KB |
Output is correct |
81 |
Correct |
541 ms |
70240 KB |
Output is correct |
82 |
Correct |
562 ms |
71464 KB |
Output is correct |
83 |
Correct |
643 ms |
66356 KB |
Output is correct |
84 |
Correct |
709 ms |
66376 KB |
Output is correct |
85 |
Correct |
751 ms |
67400 KB |
Output is correct |
86 |
Correct |
668 ms |
64004 KB |
Output is correct |
87 |
Correct |
671 ms |
63048 KB |
Output is correct |
88 |
Correct |
647 ms |
70728 KB |
Output is correct |