Submission #933210

# Submission time Handle Problem Language Result Execution time Memory
933210 2024-02-25T09:16:45 Z zhaohaikun Curtains (NOI23_curtains) C++17
100 / 100
608 ms 74580 KB
#include <bits/stdc++.h>
#define mid ((l + r) >> 1)
#define ls num << 1
#define rs ls | 1
#define li ls, l, mid
#define ri rs, mid + 1, r
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> void chkmax(T& x, T y) { x = max(x, y); }
template <typename T> void chkmin(T& x, T y) { x = min(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
const int N = 5e5 + 10;
int n, m, q;
vector <int> v[N];
int info[N << 2], tag[N << 2];
void down(int num, int x) {
	chkmax(tag[num], x);
	chkmax(info[num], x);
}
void pushdown(int num) {
	if (tag[num]) down(ls, tag[num]), down(rs, tag[num]), tag[num] = 0;
}
void pushup(int num) {
	info[num] = min(info[ls], info[rs]);
}
void change(int num, int l, int r, int L, int R, int x) {
	if (L <= l && r <= R) return down(num, x);
	pushdown(num);
	if (mid >= L) change(li, L, R, x);
	if (mid < R) change(ri, L, R, x);
	pushup(num);
}
int query(int num, int l, int r, int L, int R) {
	if (L <= l && r <= R) return info[num];
	pushdown(num);
	if (mid >= R) return query(li, L, R);
	if (mid < L) return query(ri, L, R);
	return min(query(li, L, R), query(ri, L, R));
}
bool ans[N];
vector <pair <int, int>> qq[N];
signed main() {//antirrhinum
//	freopen("antirrhinum.in", "r", stdin);
//	freopen("antirrhinum.out", "w", stdout);
	read(n), read(m), read(q);
	F(i, 1, m) {
		int l, r; read(l), read(r);
		v[r].push_back(l);
	}
	F(i, 1, q) {
		int l, r; read(l), read(r);
		qq[r].emplace_back(l, i);
	}
	F(i, 1, n) {
		for (int j: v[i]) change(1, 1, n, j, i, j);
		for (auto [a, b]: qq[i]) ans[b] = query(1, 1, n, a, i) >= a;
	}
	F(i, 1, q) puts(ans[i] ? "YES" : "NO");
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25688 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 6 ms 25692 KB Output is correct
5 Correct 7 ms 25692 KB Output is correct
6 Correct 6 ms 25688 KB Output is correct
7 Correct 5 ms 25692 KB Output is correct
8 Correct 5 ms 25692 KB Output is correct
9 Correct 5 ms 25724 KB Output is correct
10 Correct 5 ms 25692 KB Output is correct
11 Correct 5 ms 25692 KB Output is correct
12 Correct 5 ms 25692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25688 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 6 ms 25692 KB Output is correct
5 Correct 7 ms 25692 KB Output is correct
6 Correct 6 ms 25688 KB Output is correct
7 Correct 5 ms 25692 KB Output is correct
8 Correct 5 ms 25692 KB Output is correct
9 Correct 5 ms 25724 KB Output is correct
10 Correct 5 ms 25692 KB Output is correct
11 Correct 5 ms 25692 KB Output is correct
12 Correct 5 ms 25692 KB Output is correct
13 Correct 7 ms 25688 KB Output is correct
14 Correct 9 ms 25692 KB Output is correct
15 Correct 7 ms 25692 KB Output is correct
16 Correct 8 ms 25692 KB Output is correct
17 Correct 7 ms 25692 KB Output is correct
18 Correct 8 ms 25864 KB Output is correct
19 Correct 7 ms 25692 KB Output is correct
20 Correct 7 ms 25688 KB Output is correct
21 Correct 7 ms 25692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25688 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 6 ms 25692 KB Output is correct
5 Correct 7 ms 25692 KB Output is correct
6 Correct 6 ms 25688 KB Output is correct
7 Correct 5 ms 25692 KB Output is correct
8 Correct 5 ms 25692 KB Output is correct
9 Correct 5 ms 25724 KB Output is correct
10 Correct 5 ms 25692 KB Output is correct
11 Correct 5 ms 25692 KB Output is correct
12 Correct 5 ms 25692 KB Output is correct
13 Correct 7 ms 25688 KB Output is correct
14 Correct 9 ms 25692 KB Output is correct
15 Correct 7 ms 25692 KB Output is correct
16 Correct 8 ms 25692 KB Output is correct
17 Correct 7 ms 25692 KB Output is correct
18 Correct 8 ms 25864 KB Output is correct
19 Correct 7 ms 25692 KB Output is correct
20 Correct 7 ms 25688 KB Output is correct
21 Correct 7 ms 25692 KB Output is correct
22 Correct 98 ms 37712 KB Output is correct
23 Correct 102 ms 38224 KB Output is correct
24 Correct 122 ms 39708 KB Output is correct
25 Correct 217 ms 45388 KB Output is correct
26 Correct 103 ms 37852 KB Output is correct
27 Correct 209 ms 45340 KB Output is correct
28 Correct 212 ms 45252 KB Output is correct
29 Correct 86 ms 37076 KB Output is correct
30 Correct 55 ms 36944 KB Output is correct
31 Correct 74 ms 37968 KB Output is correct
32 Correct 164 ms 44388 KB Output is correct
33 Correct 54 ms 37288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 25692 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 5 ms 25692 KB Output is correct
5 Correct 7 ms 25864 KB Output is correct
6 Correct 6 ms 25692 KB Output is correct
7 Correct 7 ms 25712 KB Output is correct
8 Correct 55 ms 36948 KB Output is correct
9 Correct 65 ms 37964 KB Output is correct
10 Correct 164 ms 44368 KB Output is correct
11 Correct 55 ms 37204 KB Output is correct
12 Correct 74 ms 34644 KB Output is correct
13 Correct 73 ms 34644 KB Output is correct
14 Correct 55 ms 34644 KB Output is correct
15 Correct 56 ms 34232 KB Output is correct
16 Correct 55 ms 34536 KB Output is correct
17 Correct 54 ms 34384 KB Output is correct
18 Correct 513 ms 70624 KB Output is correct
19 Correct 514 ms 70996 KB Output is correct
20 Correct 378 ms 72832 KB Output is correct
21 Correct 409 ms 72120 KB Output is correct
22 Correct 394 ms 71084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25688 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 6 ms 25692 KB Output is correct
5 Correct 7 ms 25692 KB Output is correct
6 Correct 6 ms 25688 KB Output is correct
7 Correct 5 ms 25692 KB Output is correct
8 Correct 5 ms 25692 KB Output is correct
9 Correct 5 ms 25724 KB Output is correct
10 Correct 5 ms 25692 KB Output is correct
11 Correct 5 ms 25692 KB Output is correct
12 Correct 5 ms 25692 KB Output is correct
13 Correct 7 ms 25688 KB Output is correct
14 Correct 9 ms 25692 KB Output is correct
15 Correct 7 ms 25692 KB Output is correct
16 Correct 8 ms 25692 KB Output is correct
17 Correct 7 ms 25692 KB Output is correct
18 Correct 8 ms 25864 KB Output is correct
19 Correct 7 ms 25692 KB Output is correct
20 Correct 7 ms 25688 KB Output is correct
21 Correct 7 ms 25692 KB Output is correct
22 Correct 61 ms 30292 KB Output is correct
23 Correct 64 ms 30276 KB Output is correct
24 Correct 90 ms 33872 KB Output is correct
25 Correct 91 ms 33752 KB Output is correct
26 Correct 66 ms 35152 KB Output is correct
27 Correct 73 ms 35148 KB Output is correct
28 Correct 57 ms 32852 KB Output is correct
29 Correct 64 ms 34640 KB Output is correct
30 Correct 90 ms 33876 KB Output is correct
31 Correct 90 ms 33824 KB Output is correct
32 Correct 82 ms 34132 KB Output is correct
33 Correct 74 ms 34420 KB Output is correct
34 Correct 78 ms 33304 KB Output is correct
35 Correct 81 ms 33620 KB Output is correct
36 Correct 78 ms 34020 KB Output is correct
37 Correct 86 ms 34900 KB Output is correct
38 Correct 73 ms 34568 KB Output is correct
39 Correct 56 ms 34820 KB Output is correct
40 Correct 55 ms 34400 KB Output is correct
41 Correct 55 ms 34652 KB Output is correct
42 Correct 60 ms 34392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25688 KB Output is correct
2 Correct 5 ms 25692 KB Output is correct
3 Correct 5 ms 25692 KB Output is correct
4 Correct 6 ms 25692 KB Output is correct
5 Correct 7 ms 25692 KB Output is correct
6 Correct 6 ms 25688 KB Output is correct
7 Correct 5 ms 25692 KB Output is correct
8 Correct 5 ms 25692 KB Output is correct
9 Correct 5 ms 25724 KB Output is correct
10 Correct 5 ms 25692 KB Output is correct
11 Correct 5 ms 25692 KB Output is correct
12 Correct 5 ms 25692 KB Output is correct
13 Correct 7 ms 25688 KB Output is correct
14 Correct 9 ms 25692 KB Output is correct
15 Correct 7 ms 25692 KB Output is correct
16 Correct 8 ms 25692 KB Output is correct
17 Correct 7 ms 25692 KB Output is correct
18 Correct 8 ms 25864 KB Output is correct
19 Correct 7 ms 25692 KB Output is correct
20 Correct 7 ms 25688 KB Output is correct
21 Correct 7 ms 25692 KB Output is correct
22 Correct 98 ms 37712 KB Output is correct
23 Correct 102 ms 38224 KB Output is correct
24 Correct 122 ms 39708 KB Output is correct
25 Correct 217 ms 45388 KB Output is correct
26 Correct 103 ms 37852 KB Output is correct
27 Correct 209 ms 45340 KB Output is correct
28 Correct 212 ms 45252 KB Output is correct
29 Correct 86 ms 37076 KB Output is correct
30 Correct 55 ms 36944 KB Output is correct
31 Correct 74 ms 37968 KB Output is correct
32 Correct 164 ms 44388 KB Output is correct
33 Correct 54 ms 37288 KB Output is correct
34 Correct 5 ms 25692 KB Output is correct
35 Correct 5 ms 25692 KB Output is correct
36 Correct 5 ms 25692 KB Output is correct
37 Correct 5 ms 25692 KB Output is correct
38 Correct 7 ms 25864 KB Output is correct
39 Correct 6 ms 25692 KB Output is correct
40 Correct 7 ms 25712 KB Output is correct
41 Correct 55 ms 36948 KB Output is correct
42 Correct 65 ms 37964 KB Output is correct
43 Correct 164 ms 44368 KB Output is correct
44 Correct 55 ms 37204 KB Output is correct
45 Correct 74 ms 34644 KB Output is correct
46 Correct 73 ms 34644 KB Output is correct
47 Correct 55 ms 34644 KB Output is correct
48 Correct 56 ms 34232 KB Output is correct
49 Correct 55 ms 34536 KB Output is correct
50 Correct 54 ms 34384 KB Output is correct
51 Correct 513 ms 70624 KB Output is correct
52 Correct 514 ms 70996 KB Output is correct
53 Correct 378 ms 72832 KB Output is correct
54 Correct 409 ms 72120 KB Output is correct
55 Correct 394 ms 71084 KB Output is correct
56 Correct 61 ms 30292 KB Output is correct
57 Correct 64 ms 30276 KB Output is correct
58 Correct 90 ms 33872 KB Output is correct
59 Correct 91 ms 33752 KB Output is correct
60 Correct 66 ms 35152 KB Output is correct
61 Correct 73 ms 35148 KB Output is correct
62 Correct 57 ms 32852 KB Output is correct
63 Correct 64 ms 34640 KB Output is correct
64 Correct 90 ms 33876 KB Output is correct
65 Correct 90 ms 33824 KB Output is correct
66 Correct 82 ms 34132 KB Output is correct
67 Correct 74 ms 34420 KB Output is correct
68 Correct 78 ms 33304 KB Output is correct
69 Correct 81 ms 33620 KB Output is correct
70 Correct 78 ms 34020 KB Output is correct
71 Correct 86 ms 34900 KB Output is correct
72 Correct 73 ms 34568 KB Output is correct
73 Correct 56 ms 34820 KB Output is correct
74 Correct 55 ms 34400 KB Output is correct
75 Correct 55 ms 34652 KB Output is correct
76 Correct 60 ms 34392 KB Output is correct
77 Correct 608 ms 68592 KB Output is correct
78 Correct 565 ms 67156 KB Output is correct
79 Correct 471 ms 74580 KB Output is correct
80 Correct 456 ms 74168 KB Output is correct
81 Correct 448 ms 71612 KB Output is correct
82 Correct 486 ms 73476 KB Output is correct
83 Correct 604 ms 68784 KB Output is correct
84 Correct 598 ms 67156 KB Output is correct
85 Correct 513 ms 70224 KB Output is correct
86 Correct 484 ms 66896 KB Output is correct
87 Correct 517 ms 66668 KB Output is correct
88 Correct 469 ms 73300 KB Output is correct