# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974367 |
2024-05-03T09:18:32 Z |
CSQ31 |
Curtains (NOI23_curtains) |
C++17 |
|
823 ms |
74876 KB |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
const int MAXN = 5e5+5;
int t[4*MAXN],lazy[4*MAXN];
void pushdown(int v){
lazy[2*v] = max(lazy[2*v],lazy[v]);
lazy[2*v+1] = max(lazy[2*v+1],lazy[v]);
t[2*v] = max(t[2*v],lazy[v]);
t[2*v+1] = max(t[2*v+1],lazy[v]);
lazy[v] = 0;
}
void upd(int v,int l,int r,int tl,int tr,int val){
if(l>r)return;
// cout<<v<<" "<<l<<" "<<r<<" "<<tl<<" "<<tr<<" "<<val<<'\n';
if(l == tl && r == tr){
t[v] = max(t[v],val);
lazy[v] = max(lazy[v],val);
return;
}
int tm = (tl+tr)/2;
pushdown(v);
upd(2*v,l,min(tm,r),tl,tm,val);
upd(2*v+1,max(l,tm+1),r,tm+1,tr,val);
t[v] = min(t[2*v],t[2*v+1]);
}
int query(int v,int l,int r,int tl,int tr){
if(l>r)return 1e9;
// cout<<"q "<<v<<" "<<l<<" "<<r<<" "<<tl<<" "<<tr<<" "<<t[v]<<'\n';
if(l == tl && r == tr)return t[v];
int tm = (tl+tr)/2;
pushdown(v);
return min(query(2*v,l,min(tm,r),tl,tm),query(2*v+1,max(l,tm+1),r,tm+1,tr));
}
int main()
{
owo
int n,m,q;
cin>>n>>m>>q;
vii range(n+1);
vector<vector<pii>>que(n+1);
for(int i=0;i<m;i++){
int l,r;
cin>>l>>r;
range[r].pb(l);
}
for(int i=0;i<q;i++){
int l,r;
cin>>l>>r;
que[r].pb({l,i});
}
vector<int>ans(q+1,1);
for(int r=1;r<=n;r++){
for(int l : range[r]){
upd(1,l,r,1,n,l);
//cout<<l<<" "<<r<<'\n';
}
//for(int i=1;i<=n;i++)cout<<query(1,i,i,1,n)<<" ";
//cout<<'\n';
for(pii x : que[r]){
int res = query(1,x.fi,r,1,n);
if(res < x.fi)ans[x.se] = 0;
}
}
for(int i=0;i<q;i++){
if(ans[i])cout<<"YES"<<'\n';
else cout<<"NO"<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
3 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
3 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
600 KB |
Output is correct |
22 |
Correct |
164 ms |
10068 KB |
Output is correct |
23 |
Correct |
182 ms |
15060 KB |
Output is correct |
24 |
Correct |
206 ms |
16408 KB |
Output is correct |
25 |
Correct |
326 ms |
22124 KB |
Output is correct |
26 |
Correct |
180 ms |
14684 KB |
Output is correct |
27 |
Correct |
348 ms |
22356 KB |
Output is correct |
28 |
Correct |
341 ms |
22128 KB |
Output is correct |
29 |
Correct |
173 ms |
13652 KB |
Output is correct |
30 |
Correct |
109 ms |
13892 KB |
Output is correct |
31 |
Correct |
123 ms |
14620 KB |
Output is correct |
32 |
Correct |
270 ms |
21336 KB |
Output is correct |
33 |
Correct |
107 ms |
14060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
111 ms |
10816 KB |
Output is correct |
9 |
Correct |
127 ms |
14672 KB |
Output is correct |
10 |
Correct |
267 ms |
21332 KB |
Output is correct |
11 |
Correct |
125 ms |
13992 KB |
Output is correct |
12 |
Correct |
94 ms |
14672 KB |
Output is correct |
13 |
Correct |
102 ms |
14604 KB |
Output is correct |
14 |
Correct |
90 ms |
14916 KB |
Output is correct |
15 |
Correct |
76 ms |
14412 KB |
Output is correct |
16 |
Correct |
73 ms |
14620 KB |
Output is correct |
17 |
Correct |
72 ms |
14324 KB |
Output is correct |
18 |
Correct |
753 ms |
71292 KB |
Output is correct |
19 |
Correct |
730 ms |
71408 KB |
Output is correct |
20 |
Correct |
608 ms |
71840 KB |
Output is correct |
21 |
Correct |
559 ms |
71380 KB |
Output is correct |
22 |
Correct |
554 ms |
70680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
3 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
600 KB |
Output is correct |
22 |
Correct |
83 ms |
3920 KB |
Output is correct |
23 |
Correct |
83 ms |
5968 KB |
Output is correct |
24 |
Correct |
111 ms |
13908 KB |
Output is correct |
25 |
Correct |
112 ms |
13908 KB |
Output is correct |
26 |
Correct |
91 ms |
15188 KB |
Output is correct |
27 |
Correct |
102 ms |
15252 KB |
Output is correct |
28 |
Correct |
74 ms |
13000 KB |
Output is correct |
29 |
Correct |
86 ms |
14548 KB |
Output is correct |
30 |
Correct |
115 ms |
13908 KB |
Output is correct |
31 |
Correct |
136 ms |
13784 KB |
Output is correct |
32 |
Correct |
98 ms |
14408 KB |
Output is correct |
33 |
Correct |
97 ms |
14672 KB |
Output is correct |
34 |
Correct |
109 ms |
13304 KB |
Output is correct |
35 |
Correct |
107 ms |
13652 KB |
Output is correct |
36 |
Correct |
103 ms |
14336 KB |
Output is correct |
37 |
Correct |
108 ms |
14612 KB |
Output is correct |
38 |
Correct |
124 ms |
14668 KB |
Output is correct |
39 |
Correct |
72 ms |
14792 KB |
Output is correct |
40 |
Correct |
72 ms |
14428 KB |
Output is correct |
41 |
Correct |
84 ms |
14668 KB |
Output is correct |
42 |
Correct |
74 ms |
14416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
604 KB |
Output is correct |
15 |
Correct |
2 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
604 KB |
Output is correct |
17 |
Correct |
3 ms |
604 KB |
Output is correct |
18 |
Correct |
3 ms |
604 KB |
Output is correct |
19 |
Correct |
2 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
604 KB |
Output is correct |
21 |
Correct |
2 ms |
600 KB |
Output is correct |
22 |
Correct |
164 ms |
10068 KB |
Output is correct |
23 |
Correct |
182 ms |
15060 KB |
Output is correct |
24 |
Correct |
206 ms |
16408 KB |
Output is correct |
25 |
Correct |
326 ms |
22124 KB |
Output is correct |
26 |
Correct |
180 ms |
14684 KB |
Output is correct |
27 |
Correct |
348 ms |
22356 KB |
Output is correct |
28 |
Correct |
341 ms |
22128 KB |
Output is correct |
29 |
Correct |
173 ms |
13652 KB |
Output is correct |
30 |
Correct |
109 ms |
13892 KB |
Output is correct |
31 |
Correct |
123 ms |
14620 KB |
Output is correct |
32 |
Correct |
270 ms |
21336 KB |
Output is correct |
33 |
Correct |
107 ms |
14060 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
2 ms |
604 KB |
Output is correct |
39 |
Correct |
2 ms |
604 KB |
Output is correct |
40 |
Correct |
1 ms |
604 KB |
Output is correct |
41 |
Correct |
111 ms |
10816 KB |
Output is correct |
42 |
Correct |
127 ms |
14672 KB |
Output is correct |
43 |
Correct |
267 ms |
21332 KB |
Output is correct |
44 |
Correct |
125 ms |
13992 KB |
Output is correct |
45 |
Correct |
94 ms |
14672 KB |
Output is correct |
46 |
Correct |
102 ms |
14604 KB |
Output is correct |
47 |
Correct |
90 ms |
14916 KB |
Output is correct |
48 |
Correct |
76 ms |
14412 KB |
Output is correct |
49 |
Correct |
73 ms |
14620 KB |
Output is correct |
50 |
Correct |
72 ms |
14324 KB |
Output is correct |
51 |
Correct |
753 ms |
71292 KB |
Output is correct |
52 |
Correct |
730 ms |
71408 KB |
Output is correct |
53 |
Correct |
608 ms |
71840 KB |
Output is correct |
54 |
Correct |
559 ms |
71380 KB |
Output is correct |
55 |
Correct |
554 ms |
70680 KB |
Output is correct |
56 |
Correct |
83 ms |
3920 KB |
Output is correct |
57 |
Correct |
83 ms |
5968 KB |
Output is correct |
58 |
Correct |
111 ms |
13908 KB |
Output is correct |
59 |
Correct |
112 ms |
13908 KB |
Output is correct |
60 |
Correct |
91 ms |
15188 KB |
Output is correct |
61 |
Correct |
102 ms |
15252 KB |
Output is correct |
62 |
Correct |
74 ms |
13000 KB |
Output is correct |
63 |
Correct |
86 ms |
14548 KB |
Output is correct |
64 |
Correct |
115 ms |
13908 KB |
Output is correct |
65 |
Correct |
136 ms |
13784 KB |
Output is correct |
66 |
Correct |
98 ms |
14408 KB |
Output is correct |
67 |
Correct |
97 ms |
14672 KB |
Output is correct |
68 |
Correct |
109 ms |
13304 KB |
Output is correct |
69 |
Correct |
107 ms |
13652 KB |
Output is correct |
70 |
Correct |
103 ms |
14336 KB |
Output is correct |
71 |
Correct |
108 ms |
14612 KB |
Output is correct |
72 |
Correct |
124 ms |
14668 KB |
Output is correct |
73 |
Correct |
72 ms |
14792 KB |
Output is correct |
74 |
Correct |
72 ms |
14428 KB |
Output is correct |
75 |
Correct |
84 ms |
14668 KB |
Output is correct |
76 |
Correct |
74 ms |
14416 KB |
Output is correct |
77 |
Correct |
823 ms |
67792 KB |
Output is correct |
78 |
Correct |
810 ms |
67744 KB |
Output is correct |
79 |
Correct |
647 ms |
74876 KB |
Output is correct |
80 |
Correct |
657 ms |
74692 KB |
Output is correct |
81 |
Correct |
695 ms |
72224 KB |
Output is correct |
82 |
Correct |
641 ms |
73364 KB |
Output is correct |
83 |
Correct |
800 ms |
67920 KB |
Output is correct |
84 |
Correct |
822 ms |
67888 KB |
Output is correct |
85 |
Correct |
766 ms |
69440 KB |
Output is correct |
86 |
Correct |
711 ms |
66352 KB |
Output is correct |
87 |
Correct |
712 ms |
65692 KB |
Output is correct |
88 |
Correct |
735 ms |
72228 KB |
Output is correct |