Submission #886204

# Submission time Handle Problem Language Result Execution time Memory
886204 2023-12-11T14:57:59 Z vjudge1 Curtains (NOI23_curtains) C++17
60 / 100
1500 ms 79436 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 7;
const int inf = 1e9 + 7;
struct SEGT{
	int tree[N];
	SEGT(){
		for(int i = 0;i<N;i++){
			tree[i] = inf;
		}
	}
	void update(int ind , int l , int r , int ql , int qr){
		if(l >= ql and r <= qr){
			tree[ind] = min(tree[ind] , qr);
			return;
		}
		else if(l > qr or r < ql){
			return;
		}
		else{
			int mid = (l+r)/2;
			update(ind*2,l,mid,ql,qr);
			update(ind*2+1,mid+1,r,ql,qr);
			tree[ind] = min(tree[ind] , max(tree[ind*2] , tree[ind*2+1]));
		}
	}
	bool query(int ind , int l , int r , int ql , int qr){
		if(l >= ql and r <= qr){
			return tree[ind] <= qr;
		}
		else if(l > qr or r < ql){
			return 1;
		}
		else{
			int mid = (l+r)/2;
			return query(ind*2,l,mid,ql,qr) and query(ind*2+1,mid+1,r,ql,qr);
		}
	}
} segt;
void solve(){
	int n,m,q;
	cin >> n >> m >> q;
	vector < int > query[n+1] , ran[n+1];
	for(int i = 0;i<m;i++){
		int x,y;
		cin >> x >> y;
		ran[x].push_back(y);
	}
	map < pair < int , int > , int > mpa;
	vector < pair < int , int > > v;
	for(int i = 0;i<q;i++){
		int x,y;
		cin >> x >> y;
		v.push_back({x,y});
		query[x].push_back(y);
	}
	for(int i = n;i>0;i--){
		for(auto itr : ran[i]){
			segt.update(1,1,n,i,itr);
		}
		for(auto itr : query[i]){
			mpa[{i,itr}] = segt.query(1,1,n,i,itr);
		}
	}
	for(auto itr : v){
		cout << (mpa[itr] ? "YES" : "NO") << endl;
	}
}
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int testcase = 1;//cin >> testcase;
	while(testcase--)solve();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 2 ms 8284 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 2 ms 8272 KB Output is correct
8 Correct 2 ms 8284 KB Output is correct
9 Correct 2 ms 8284 KB Output is correct
10 Correct 2 ms 8284 KB Output is correct
11 Correct 2 ms 8284 KB Output is correct
12 Correct 3 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 2 ms 8284 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 2 ms 8272 KB Output is correct
8 Correct 2 ms 8284 KB Output is correct
9 Correct 2 ms 8284 KB Output is correct
10 Correct 2 ms 8284 KB Output is correct
11 Correct 2 ms 8284 KB Output is correct
12 Correct 3 ms 8284 KB Output is correct
13 Correct 6 ms 8540 KB Output is correct
14 Correct 6 ms 8592 KB Output is correct
15 Correct 8 ms 8540 KB Output is correct
16 Correct 6 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 5 ms 8540 KB Output is correct
19 Correct 5 ms 8540 KB Output is correct
20 Correct 6 ms 8540 KB Output is correct
21 Correct 6 ms 8536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 2 ms 8284 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 2 ms 8272 KB Output is correct
8 Correct 2 ms 8284 KB Output is correct
9 Correct 2 ms 8284 KB Output is correct
10 Correct 2 ms 8284 KB Output is correct
11 Correct 2 ms 8284 KB Output is correct
12 Correct 3 ms 8284 KB Output is correct
13 Correct 6 ms 8540 KB Output is correct
14 Correct 6 ms 8592 KB Output is correct
15 Correct 8 ms 8540 KB Output is correct
16 Correct 6 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 5 ms 8540 KB Output is correct
19 Correct 5 ms 8540 KB Output is correct
20 Correct 6 ms 8540 KB Output is correct
21 Correct 6 ms 8536 KB Output is correct
22 Correct 978 ms 44408 KB Output is correct
23 Correct 1054 ms 44860 KB Output is correct
24 Correct 1036 ms 48312 KB Output is correct
25 Correct 1125 ms 52364 KB Output is correct
26 Correct 1006 ms 47364 KB Output is correct
27 Correct 1130 ms 52308 KB Output is correct
28 Correct 1112 ms 52220 KB Output is correct
29 Correct 860 ms 35796 KB Output is correct
30 Correct 684 ms 20404 KB Output is correct
31 Correct 737 ms 20848 KB Output is correct
32 Correct 817 ms 26028 KB Output is correct
33 Correct 691 ms 20444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 3 ms 8284 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 6 ms 8540 KB Output is correct
6 Correct 6 ms 8540 KB Output is correct
7 Correct 5 ms 8540 KB Output is correct
8 Correct 689 ms 18236 KB Output is correct
9 Correct 705 ms 18628 KB Output is correct
10 Correct 817 ms 21712 KB Output is correct
11 Correct 687 ms 18244 KB Output is correct
12 Correct 234 ms 22468 KB Output is correct
13 Correct 224 ms 22472 KB Output is correct
14 Correct 202 ms 22596 KB Output is correct
15 Correct 202 ms 22520 KB Output is correct
16 Correct 209 ms 22552 KB Output is correct
17 Correct 201 ms 22648 KB Output is correct
18 Execution timed out 1545 ms 79436 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 2 ms 8284 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 2 ms 8272 KB Output is correct
8 Correct 2 ms 8284 KB Output is correct
9 Correct 2 ms 8284 KB Output is correct
10 Correct 2 ms 8284 KB Output is correct
11 Correct 2 ms 8284 KB Output is correct
12 Correct 3 ms 8284 KB Output is correct
13 Correct 6 ms 8540 KB Output is correct
14 Correct 6 ms 8592 KB Output is correct
15 Correct 8 ms 8540 KB Output is correct
16 Correct 6 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 5 ms 8540 KB Output is correct
19 Correct 5 ms 8540 KB Output is correct
20 Correct 6 ms 8540 KB Output is correct
21 Correct 6 ms 8536 KB Output is correct
22 Correct 208 ms 17604 KB Output is correct
23 Correct 204 ms 18884 KB Output is correct
24 Correct 239 ms 25508 KB Output is correct
25 Correct 229 ms 25356 KB Output is correct
26 Correct 219 ms 27080 KB Output is correct
27 Correct 221 ms 27188 KB Output is correct
28 Correct 189 ms 25128 KB Output is correct
29 Correct 199 ms 26592 KB Output is correct
30 Correct 220 ms 25304 KB Output is correct
31 Correct 229 ms 25416 KB Output is correct
32 Correct 218 ms 25892 KB Output is correct
33 Correct 214 ms 26256 KB Output is correct
34 Correct 214 ms 25284 KB Output is correct
35 Correct 225 ms 24680 KB Output is correct
36 Correct 213 ms 25296 KB Output is correct
37 Correct 228 ms 23744 KB Output is correct
38 Correct 234 ms 23752 KB Output is correct
39 Correct 203 ms 23892 KB Output is correct
40 Correct 217 ms 24144 KB Output is correct
41 Correct 229 ms 23884 KB Output is correct
42 Correct 206 ms 23876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 3 ms 8284 KB Output is correct
5 Correct 2 ms 8284 KB Output is correct
6 Correct 2 ms 8284 KB Output is correct
7 Correct 2 ms 8272 KB Output is correct
8 Correct 2 ms 8284 KB Output is correct
9 Correct 2 ms 8284 KB Output is correct
10 Correct 2 ms 8284 KB Output is correct
11 Correct 2 ms 8284 KB Output is correct
12 Correct 3 ms 8284 KB Output is correct
13 Correct 6 ms 8540 KB Output is correct
14 Correct 6 ms 8592 KB Output is correct
15 Correct 8 ms 8540 KB Output is correct
16 Correct 6 ms 8540 KB Output is correct
17 Correct 5 ms 8540 KB Output is correct
18 Correct 5 ms 8540 KB Output is correct
19 Correct 5 ms 8540 KB Output is correct
20 Correct 6 ms 8540 KB Output is correct
21 Correct 6 ms 8536 KB Output is correct
22 Correct 978 ms 44408 KB Output is correct
23 Correct 1054 ms 44860 KB Output is correct
24 Correct 1036 ms 48312 KB Output is correct
25 Correct 1125 ms 52364 KB Output is correct
26 Correct 1006 ms 47364 KB Output is correct
27 Correct 1130 ms 52308 KB Output is correct
28 Correct 1112 ms 52220 KB Output is correct
29 Correct 860 ms 35796 KB Output is correct
30 Correct 684 ms 20404 KB Output is correct
31 Correct 737 ms 20848 KB Output is correct
32 Correct 817 ms 26028 KB Output is correct
33 Correct 691 ms 20444 KB Output is correct
34 Correct 2 ms 8028 KB Output is correct
35 Correct 3 ms 8284 KB Output is correct
36 Correct 2 ms 8284 KB Output is correct
37 Correct 3 ms 8284 KB Output is correct
38 Correct 6 ms 8540 KB Output is correct
39 Correct 6 ms 8540 KB Output is correct
40 Correct 5 ms 8540 KB Output is correct
41 Correct 689 ms 18236 KB Output is correct
42 Correct 705 ms 18628 KB Output is correct
43 Correct 817 ms 21712 KB Output is correct
44 Correct 687 ms 18244 KB Output is correct
45 Correct 234 ms 22468 KB Output is correct
46 Correct 224 ms 22472 KB Output is correct
47 Correct 202 ms 22596 KB Output is correct
48 Correct 202 ms 22520 KB Output is correct
49 Correct 209 ms 22552 KB Output is correct
50 Correct 201 ms 22648 KB Output is correct
51 Execution timed out 1545 ms 79436 KB Time limit exceeded
52 Halted 0 ms 0 KB -