# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829489 | 2023-08-18T11:25:17 Z | rainboy | Curtains (NOI23_curtains) | C | 196 ms | 13684 KB |
#include <stdio.h> #define N 500000 #define SMALL 2000 #define M 500000 int min(int a, int b) { return a < b ? a : b; } int main() { static int ll[N], qu[N]; int n, m, q, cnt, l, r; scanf("%d%d%d", &n, &m, &q); if (n <= SMALL) { static char has[SMALL][SMALL], can[SMALL][SMALL]; while (m--) { scanf("%d%d", &l, &r), l--, r--; has[l][r] = 1; } for (r = 0; r < n; r++) ll[r] = r + 1; for (l = n - 1; l >= 0; l--) { for (r = l; r < n; r++) if (has[l][r]) ll[r] = l; cnt = 0; for (r = l; r < n; r++) { qu[cnt++] = r; while (cnt && qu[cnt - 1] >= ll[r]) cnt--; can[l][r] = cnt == 0; } } while (q--) { scanf("%d%d", &l, &r), l--, r--; printf(can[l][r] ? "YES\n" : "NO\n"); } } else { static char can[N]; for (r = 0; r < n; r++) ll[r] = r + 1; while (m--) { scanf("%d%d", &l, &r), l--, r--; ll[r] = min(ll[r], l); } cnt = 0; for (r = 0; r < n; r++) { qu[cnt++] = r; while (cnt && qu[cnt - 1] >= ll[r]) cnt--; can[r] = cnt == 0; } while (q--) { scanf("%d%d", &l, &r), l--, r--; printf(can[r] ? "YES\n" : "NO\n"); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 924 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 924 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 10 ms | 7124 KB | Output is correct |
14 | Correct | 11 ms | 7184 KB | Output is correct |
15 | Correct | 11 ms | 7124 KB | Output is correct |
16 | Correct | 12 ms | 7208 KB | Output is correct |
17 | Correct | 10 ms | 7124 KB | Output is correct |
18 | Correct | 10 ms | 7568 KB | Output is correct |
19 | Correct | 10 ms | 7568 KB | Output is correct |
20 | Correct | 7 ms | 8020 KB | Output is correct |
21 | Correct | 8 ms | 8020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 924 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 10 ms | 7124 KB | Output is correct |
14 | Correct | 11 ms | 7184 KB | Output is correct |
15 | Correct | 11 ms | 7124 KB | Output is correct |
16 | Correct | 12 ms | 7208 KB | Output is correct |
17 | Correct | 10 ms | 7124 KB | Output is correct |
18 | Correct | 10 ms | 7568 KB | Output is correct |
19 | Correct | 10 ms | 7568 KB | Output is correct |
20 | Correct | 7 ms | 8020 KB | Output is correct |
21 | Correct | 8 ms | 8020 KB | Output is correct |
22 | Correct | 90 ms | 8012 KB | Output is correct |
23 | Correct | 92 ms | 9784 KB | Output is correct |
24 | Correct | 113 ms | 10064 KB | Output is correct |
25 | Correct | 196 ms | 10060 KB | Output is correct |
26 | Correct | 92 ms | 9420 KB | Output is correct |
27 | Correct | 151 ms | 10092 KB | Output is correct |
28 | Correct | 160 ms | 10120 KB | Output is correct |
29 | Correct | 89 ms | 9408 KB | Output is correct |
30 | Correct | 85 ms | 9660 KB | Output is correct |
31 | Correct | 88 ms | 9960 KB | Output is correct |
32 | Correct | 151 ms | 10060 KB | Output is correct |
33 | Correct | 82 ms | 10060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 980 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 10 ms | 7096 KB | Output is correct |
6 | Correct | 10 ms | 7636 KB | Output is correct |
7 | Correct | 10 ms | 7508 KB | Output is correct |
8 | Correct | 85 ms | 9616 KB | Output is correct |
9 | Correct | 88 ms | 9988 KB | Output is correct |
10 | Correct | 147 ms | 10056 KB | Output is correct |
11 | Correct | 102 ms | 9992 KB | Output is correct |
12 | Correct | 32 ms | 2840 KB | Output is correct |
13 | Correct | 31 ms | 2708 KB | Output is correct |
14 | Correct | 30 ms | 2604 KB | Output is correct |
15 | Correct | 31 ms | 2772 KB | Output is correct |
16 | Correct | 30 ms | 2768 KB | Output is correct |
17 | Correct | 31 ms | 2604 KB | Output is correct |
18 | Correct | 159 ms | 13684 KB | Output is correct |
19 | Correct | 186 ms | 12292 KB | Output is correct |
20 | Correct | 157 ms | 13464 KB | Output is correct |
21 | Correct | 166 ms | 12360 KB | Output is correct |
22 | Correct | 164 ms | 12216 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 924 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 10 ms | 7124 KB | Output is correct |
14 | Correct | 11 ms | 7184 KB | Output is correct |
15 | Correct | 11 ms | 7124 KB | Output is correct |
16 | Correct | 12 ms | 7208 KB | Output is correct |
17 | Correct | 10 ms | 7124 KB | Output is correct |
18 | Correct | 10 ms | 7568 KB | Output is correct |
19 | Correct | 10 ms | 7568 KB | Output is correct |
20 | Correct | 7 ms | 8020 KB | Output is correct |
21 | Correct | 8 ms | 8020 KB | Output is correct |
22 | Incorrect | 30 ms | 2300 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 980 KB | Output is correct |
4 | Correct | 1 ms | 980 KB | Output is correct |
5 | Correct | 1 ms | 924 KB | Output is correct |
6 | Correct | 1 ms | 980 KB | Output is correct |
7 | Correct | 1 ms | 980 KB | Output is correct |
8 | Correct | 1 ms | 980 KB | Output is correct |
9 | Correct | 1 ms | 980 KB | Output is correct |
10 | Correct | 1 ms | 980 KB | Output is correct |
11 | Correct | 1 ms | 980 KB | Output is correct |
12 | Correct | 1 ms | 980 KB | Output is correct |
13 | Correct | 10 ms | 7124 KB | Output is correct |
14 | Correct | 11 ms | 7184 KB | Output is correct |
15 | Correct | 11 ms | 7124 KB | Output is correct |
16 | Correct | 12 ms | 7208 KB | Output is correct |
17 | Correct | 10 ms | 7124 KB | Output is correct |
18 | Correct | 10 ms | 7568 KB | Output is correct |
19 | Correct | 10 ms | 7568 KB | Output is correct |
20 | Correct | 7 ms | 8020 KB | Output is correct |
21 | Correct | 8 ms | 8020 KB | Output is correct |
22 | Correct | 90 ms | 8012 KB | Output is correct |
23 | Correct | 92 ms | 9784 KB | Output is correct |
24 | Correct | 113 ms | 10064 KB | Output is correct |
25 | Correct | 196 ms | 10060 KB | Output is correct |
26 | Correct | 92 ms | 9420 KB | Output is correct |
27 | Correct | 151 ms | 10092 KB | Output is correct |
28 | Correct | 160 ms | 10120 KB | Output is correct |
29 | Correct | 89 ms | 9408 KB | Output is correct |
30 | Correct | 85 ms | 9660 KB | Output is correct |
31 | Correct | 88 ms | 9960 KB | Output is correct |
32 | Correct | 151 ms | 10060 KB | Output is correct |
33 | Correct | 82 ms | 10060 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 1 ms | 980 KB | Output is correct |
36 | Correct | 1 ms | 980 KB | Output is correct |
37 | Correct | 1 ms | 980 KB | Output is correct |
38 | Correct | 10 ms | 7096 KB | Output is correct |
39 | Correct | 10 ms | 7636 KB | Output is correct |
40 | Correct | 10 ms | 7508 KB | Output is correct |
41 | Correct | 85 ms | 9616 KB | Output is correct |
42 | Correct | 88 ms | 9988 KB | Output is correct |
43 | Correct | 147 ms | 10056 KB | Output is correct |
44 | Correct | 102 ms | 9992 KB | Output is correct |
45 | Correct | 32 ms | 2840 KB | Output is correct |
46 | Correct | 31 ms | 2708 KB | Output is correct |
47 | Correct | 30 ms | 2604 KB | Output is correct |
48 | Correct | 31 ms | 2772 KB | Output is correct |
49 | Correct | 30 ms | 2768 KB | Output is correct |
50 | Correct | 31 ms | 2604 KB | Output is correct |
51 | Correct | 159 ms | 13684 KB | Output is correct |
52 | Correct | 186 ms | 12292 KB | Output is correct |
53 | Correct | 157 ms | 13464 KB | Output is correct |
54 | Correct | 166 ms | 12360 KB | Output is correct |
55 | Correct | 164 ms | 12216 KB | Output is correct |
56 | Incorrect | 30 ms | 2300 KB | Output isn't correct |
57 | Halted | 0 ms | 0 KB | - |