Submission #1100859

# Submission time Handle Problem Language Result Execution time Memory
1100859 2024-10-14T20:17:22 Z imarn Curtains (NOI23_curtains) C++14
100 / 100
813 ms 78920 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
using namespace std;
const int mxn=5e5+5;
vector<int>upd[mxn];
vector<pii>qr[mxn];
int t[4*mxn],lz[4*mxn]{0};
void build(int i,int l,int r){
    lz[i]=1e9;
    if(l==r)return void(t[i]=1e9);
    int m=(l+r)>>1;build(2*i,l,m);build(2*i+1,m+1,r);
    t[i]=max(t[2*i],t[2*i+1]);
}
void push(int i,int l,int r){
    t[i]=min(t[i],lz[i]);
    if(l<r)lz[2*i]=min(lz[2*i],lz[i]),lz[2*i+1]=min(lz[2*i+1],lz[i]);
    lz[i]=1e9;
}
void update(int i,int l,int r,int tl,int tr,int v){
    push(i,l,r);
    if(r<tl||l>tr)return;
    if(r<=tr&&l>=tl){
        lz[i]=min(lz[i],v);push(i,l,r);return;
    }int m=(l+r)>>1;update(2*i,l,m,tl,tr,v);update(2*i+1,m+1,r,tl,tr,v);
    t[i]=max(t[2*i],t[2*i+1]);
}
int query(int i,int l,int r,int tl,int tr){
    push(i,l,r);
    if(r<tl||l>tr)return 0;
    if(r<=tr&&l>=tl)return t[i];
    int m=(l+r)>>1;
    return max(query(2*i,l,m,tl,tr),query(2*i+1,m+1,r,tl,tr));
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,m,q;cin>>n>>m>>q;
    for(int i=1;i<=m;i++){
        int l,r;cin>>l>>r;
        upd[l].pb(r);
    }
    for(int i=1;i<=q;i++){
        int l,r;cin>>l>>r;
        qr[l].pb({r,i});
    }build(1,1,n);int ans[q+1]={0};
    for(int i=n;i>=1;i--){
        for(auto it : upd[i])update(1,1,n,i,it,it);
        for(auto it : qr[i])ans[it.s]=(query(1,1,n,i,it.f)<=it.f);
    }
    for(int i=1;i<=q;i++)cout<<(ans[i]?"YES\n":"NO\n");
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 5 ms 26960 KB Output is correct
4 Correct 5 ms 26960 KB Output is correct
5 Correct 6 ms 26960 KB Output is correct
6 Correct 6 ms 26960 KB Output is correct
7 Correct 6 ms 26960 KB Output is correct
8 Correct 6 ms 27124 KB Output is correct
9 Correct 6 ms 26960 KB Output is correct
10 Correct 6 ms 27128 KB Output is correct
11 Correct 5 ms 26960 KB Output is correct
12 Correct 6 ms 26960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 5 ms 26960 KB Output is correct
4 Correct 5 ms 26960 KB Output is correct
5 Correct 6 ms 26960 KB Output is correct
6 Correct 6 ms 26960 KB Output is correct
7 Correct 6 ms 26960 KB Output is correct
8 Correct 6 ms 27124 KB Output is correct
9 Correct 6 ms 26960 KB Output is correct
10 Correct 6 ms 27128 KB Output is correct
11 Correct 5 ms 26960 KB Output is correct
12 Correct 6 ms 26960 KB Output is correct
13 Correct 7 ms 27216 KB Output is correct
14 Correct 7 ms 27384 KB Output is correct
15 Correct 8 ms 27216 KB Output is correct
16 Correct 7 ms 27216 KB Output is correct
17 Correct 7 ms 27020 KB Output is correct
18 Correct 7 ms 27120 KB Output is correct
19 Correct 7 ms 27384 KB Output is correct
20 Correct 8 ms 27216 KB Output is correct
21 Correct 7 ms 27216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 5 ms 26960 KB Output is correct
4 Correct 5 ms 26960 KB Output is correct
5 Correct 6 ms 26960 KB Output is correct
6 Correct 6 ms 26960 KB Output is correct
7 Correct 6 ms 26960 KB Output is correct
8 Correct 6 ms 27124 KB Output is correct
9 Correct 6 ms 26960 KB Output is correct
10 Correct 6 ms 27128 KB Output is correct
11 Correct 5 ms 26960 KB Output is correct
12 Correct 6 ms 26960 KB Output is correct
13 Correct 7 ms 27216 KB Output is correct
14 Correct 7 ms 27384 KB Output is correct
15 Correct 8 ms 27216 KB Output is correct
16 Correct 7 ms 27216 KB Output is correct
17 Correct 7 ms 27020 KB Output is correct
18 Correct 7 ms 27120 KB Output is correct
19 Correct 7 ms 27384 KB Output is correct
20 Correct 8 ms 27216 KB Output is correct
21 Correct 7 ms 27216 KB Output is correct
22 Correct 183 ms 41032 KB Output is correct
23 Correct 185 ms 41544 KB Output is correct
24 Correct 235 ms 43084 KB Output is correct
25 Correct 379 ms 48712 KB Output is correct
26 Correct 183 ms 41288 KB Output is correct
27 Correct 355 ms 48712 KB Output is correct
28 Correct 390 ms 48712 KB Output is correct
29 Correct 181 ms 41288 KB Output is correct
30 Correct 128 ms 38320 KB Output is correct
31 Correct 144 ms 39100 KB Output is correct
32 Correct 306 ms 45916 KB Output is correct
33 Correct 133 ms 38576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 6 ms 27128 KB Output is correct
4 Correct 6 ms 26960 KB Output is correct
5 Correct 11 ms 27216 KB Output is correct
6 Correct 6 ms 27172 KB Output is correct
7 Correct 7 ms 27216 KB Output is correct
8 Correct 126 ms 38364 KB Output is correct
9 Correct 151 ms 39096 KB Output is correct
10 Correct 297 ms 46004 KB Output is correct
11 Correct 131 ms 38464 KB Output is correct
12 Correct 104 ms 36540 KB Output is correct
13 Correct 100 ms 36540 KB Output is correct
14 Correct 81 ms 36804 KB Output is correct
15 Correct 80 ms 36640 KB Output is correct
16 Correct 81 ms 36820 KB Output is correct
17 Correct 88 ms 36796 KB Output is correct
18 Correct 552 ms 63124 KB Output is correct
19 Correct 571 ms 63156 KB Output is correct
20 Correct 498 ms 63968 KB Output is correct
21 Correct 458 ms 63748 KB Output is correct
22 Correct 459 ms 63672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 5 ms 26960 KB Output is correct
4 Correct 5 ms 26960 KB Output is correct
5 Correct 6 ms 26960 KB Output is correct
6 Correct 6 ms 26960 KB Output is correct
7 Correct 6 ms 26960 KB Output is correct
8 Correct 6 ms 27124 KB Output is correct
9 Correct 6 ms 26960 KB Output is correct
10 Correct 6 ms 27128 KB Output is correct
11 Correct 5 ms 26960 KB Output is correct
12 Correct 6 ms 26960 KB Output is correct
13 Correct 7 ms 27216 KB Output is correct
14 Correct 7 ms 27384 KB Output is correct
15 Correct 8 ms 27216 KB Output is correct
16 Correct 7 ms 27216 KB Output is correct
17 Correct 7 ms 27020 KB Output is correct
18 Correct 7 ms 27120 KB Output is correct
19 Correct 7 ms 27384 KB Output is correct
20 Correct 8 ms 27216 KB Output is correct
21 Correct 7 ms 27216 KB Output is correct
22 Correct 95 ms 32072 KB Output is correct
23 Correct 96 ms 32028 KB Output is correct
24 Correct 135 ms 37960 KB Output is correct
25 Correct 125 ms 37960 KB Output is correct
26 Correct 111 ms 39496 KB Output is correct
27 Correct 108 ms 39496 KB Output is correct
28 Correct 88 ms 37448 KB Output is correct
29 Correct 117 ms 38992 KB Output is correct
30 Correct 128 ms 37960 KB Output is correct
31 Correct 125 ms 37960 KB Output is correct
32 Correct 112 ms 38472 KB Output is correct
33 Correct 101 ms 38728 KB Output is correct
34 Correct 115 ms 37704 KB Output is correct
35 Correct 116 ms 37704 KB Output is correct
36 Correct 110 ms 37960 KB Output is correct
37 Correct 103 ms 36544 KB Output is correct
38 Correct 101 ms 36668 KB Output is correct
39 Correct 82 ms 36836 KB Output is correct
40 Correct 82 ms 36800 KB Output is correct
41 Correct 85 ms 36836 KB Output is correct
42 Correct 84 ms 36824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 26960 KB Output is correct
2 Correct 5 ms 26960 KB Output is correct
3 Correct 5 ms 26960 KB Output is correct
4 Correct 5 ms 26960 KB Output is correct
5 Correct 6 ms 26960 KB Output is correct
6 Correct 6 ms 26960 KB Output is correct
7 Correct 6 ms 26960 KB Output is correct
8 Correct 6 ms 27124 KB Output is correct
9 Correct 6 ms 26960 KB Output is correct
10 Correct 6 ms 27128 KB Output is correct
11 Correct 5 ms 26960 KB Output is correct
12 Correct 6 ms 26960 KB Output is correct
13 Correct 7 ms 27216 KB Output is correct
14 Correct 7 ms 27384 KB Output is correct
15 Correct 8 ms 27216 KB Output is correct
16 Correct 7 ms 27216 KB Output is correct
17 Correct 7 ms 27020 KB Output is correct
18 Correct 7 ms 27120 KB Output is correct
19 Correct 7 ms 27384 KB Output is correct
20 Correct 8 ms 27216 KB Output is correct
21 Correct 7 ms 27216 KB Output is correct
22 Correct 183 ms 41032 KB Output is correct
23 Correct 185 ms 41544 KB Output is correct
24 Correct 235 ms 43084 KB Output is correct
25 Correct 379 ms 48712 KB Output is correct
26 Correct 183 ms 41288 KB Output is correct
27 Correct 355 ms 48712 KB Output is correct
28 Correct 390 ms 48712 KB Output is correct
29 Correct 181 ms 41288 KB Output is correct
30 Correct 128 ms 38320 KB Output is correct
31 Correct 144 ms 39100 KB Output is correct
32 Correct 306 ms 45916 KB Output is correct
33 Correct 133 ms 38576 KB Output is correct
34 Correct 6 ms 26960 KB Output is correct
35 Correct 5 ms 26960 KB Output is correct
36 Correct 6 ms 27128 KB Output is correct
37 Correct 6 ms 26960 KB Output is correct
38 Correct 11 ms 27216 KB Output is correct
39 Correct 6 ms 27172 KB Output is correct
40 Correct 7 ms 27216 KB Output is correct
41 Correct 126 ms 38364 KB Output is correct
42 Correct 151 ms 39096 KB Output is correct
43 Correct 297 ms 46004 KB Output is correct
44 Correct 131 ms 38464 KB Output is correct
45 Correct 104 ms 36540 KB Output is correct
46 Correct 100 ms 36540 KB Output is correct
47 Correct 81 ms 36804 KB Output is correct
48 Correct 80 ms 36640 KB Output is correct
49 Correct 81 ms 36820 KB Output is correct
50 Correct 88 ms 36796 KB Output is correct
51 Correct 552 ms 63124 KB Output is correct
52 Correct 571 ms 63156 KB Output is correct
53 Correct 498 ms 63968 KB Output is correct
54 Correct 458 ms 63748 KB Output is correct
55 Correct 459 ms 63672 KB Output is correct
56 Correct 95 ms 32072 KB Output is correct
57 Correct 96 ms 32028 KB Output is correct
58 Correct 135 ms 37960 KB Output is correct
59 Correct 125 ms 37960 KB Output is correct
60 Correct 111 ms 39496 KB Output is correct
61 Correct 108 ms 39496 KB Output is correct
62 Correct 88 ms 37448 KB Output is correct
63 Correct 117 ms 38992 KB Output is correct
64 Correct 128 ms 37960 KB Output is correct
65 Correct 125 ms 37960 KB Output is correct
66 Correct 112 ms 38472 KB Output is correct
67 Correct 101 ms 38728 KB Output is correct
68 Correct 115 ms 37704 KB Output is correct
69 Correct 116 ms 37704 KB Output is correct
70 Correct 110 ms 37960 KB Output is correct
71 Correct 103 ms 36544 KB Output is correct
72 Correct 101 ms 36668 KB Output is correct
73 Correct 82 ms 36836 KB Output is correct
74 Correct 82 ms 36800 KB Output is correct
75 Correct 85 ms 36836 KB Output is correct
76 Correct 84 ms 36824 KB Output is correct
77 Correct 773 ms 71132 KB Output is correct
78 Correct 813 ms 70988 KB Output is correct
79 Correct 687 ms 78920 KB Output is correct
80 Correct 684 ms 78816 KB Output is correct
81 Correct 675 ms 76616 KB Output is correct
82 Correct 658 ms 78108 KB Output is correct
83 Correct 788 ms 70984 KB Output is correct
84 Correct 801 ms 71136 KB Output is correct
85 Correct 693 ms 72128 KB Output is correct
86 Correct 679 ms 67792 KB Output is correct
87 Correct 688 ms 67184 KB Output is correct
88 Correct 698 ms 75580 KB Output is correct