Submission #829487

# Submission time Handle Problem Language Result Execution time Memory
829487 2023-08-18T11:22:39 Z rainboy Curtains (NOI23_curtains) C
24 / 100
176 ms 18288 KB
#include <stdio.h>

#define N	2000
#define M	500000

int main() {
	static char has[N][N], can[N][N];
	static int ll[N], qu[N];
	int n, m, q, cnt, l, r;

	scanf("%d%d%d", &n, &m, &q);
	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");
	}
	return 0;
}

Compilation message

curtains.c: In function 'main':
curtains.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d%d", &n, &m, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
curtains.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
curtains.c:31:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 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 852 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 928 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 1056 KB Output is correct
12 Correct 1 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 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 852 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 928 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 1056 KB Output is correct
12 Correct 1 ms 992 KB Output is correct
13 Correct 10 ms 7124 KB Output is correct
14 Correct 12 ms 7264 KB Output is correct
15 Correct 10 ms 7148 KB Output is correct
16 Correct 10 ms 7308 KB Output is correct
17 Correct 10 ms 7108 KB Output is correct
18 Correct 11 ms 7648 KB Output is correct
19 Correct 10 ms 7600 KB Output is correct
20 Correct 8 ms 8148 KB Output is correct
21 Correct 9 ms 8020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 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 852 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 928 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 1056 KB Output is correct
12 Correct 1 ms 992 KB Output is correct
13 Correct 10 ms 7124 KB Output is correct
14 Correct 12 ms 7264 KB Output is correct
15 Correct 10 ms 7148 KB Output is correct
16 Correct 10 ms 7308 KB Output is correct
17 Correct 10 ms 7108 KB Output is correct
18 Correct 11 ms 7648 KB Output is correct
19 Correct 10 ms 7600 KB Output is correct
20 Correct 8 ms 8148 KB Output is correct
21 Correct 9 ms 8020 KB Output is correct
22 Correct 127 ms 11824 KB Output is correct
23 Correct 99 ms 13644 KB Output is correct
24 Correct 105 ms 14728 KB Output is correct
25 Correct 175 ms 18288 KB Output is correct
26 Correct 96 ms 13344 KB Output is correct
27 Correct 166 ms 17852 KB Output is correct
28 Correct 176 ms 18100 KB Output is correct
29 Correct 97 ms 12832 KB Output is correct
30 Correct 89 ms 12268 KB Output is correct
31 Correct 116 ms 13024 KB Output is correct
32 Correct 156 ms 16708 KB Output is correct
33 Correct 90 ms 12948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 852 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 7200 KB Output is correct
6 Correct 10 ms 7636 KB Output is correct
7 Correct 10 ms 7568 KB Output is correct
8 Correct 114 ms 12428 KB Output is correct
9 Correct 93 ms 13260 KB Output is correct
10 Correct 160 ms 16856 KB Output is correct
11 Correct 87 ms 12584 KB Output is correct
12 Runtime error 1 ms 300 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 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 852 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 928 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 1056 KB Output is correct
12 Correct 1 ms 992 KB Output is correct
13 Correct 10 ms 7124 KB Output is correct
14 Correct 12 ms 7264 KB Output is correct
15 Correct 10 ms 7148 KB Output is correct
16 Correct 10 ms 7308 KB Output is correct
17 Correct 10 ms 7108 KB Output is correct
18 Correct 11 ms 7648 KB Output is correct
19 Correct 10 ms 7600 KB Output is correct
20 Correct 8 ms 8148 KB Output is correct
21 Correct 9 ms 8020 KB Output is correct
22 Runtime error 1 ms 340 KB Execution killed with signal 11
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 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 852 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 928 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 1056 KB Output is correct
12 Correct 1 ms 992 KB Output is correct
13 Correct 10 ms 7124 KB Output is correct
14 Correct 12 ms 7264 KB Output is correct
15 Correct 10 ms 7148 KB Output is correct
16 Correct 10 ms 7308 KB Output is correct
17 Correct 10 ms 7108 KB Output is correct
18 Correct 11 ms 7648 KB Output is correct
19 Correct 10 ms 7600 KB Output is correct
20 Correct 8 ms 8148 KB Output is correct
21 Correct 9 ms 8020 KB Output is correct
22 Correct 127 ms 11824 KB Output is correct
23 Correct 99 ms 13644 KB Output is correct
24 Correct 105 ms 14728 KB Output is correct
25 Correct 175 ms 18288 KB Output is correct
26 Correct 96 ms 13344 KB Output is correct
27 Correct 166 ms 17852 KB Output is correct
28 Correct 176 ms 18100 KB Output is correct
29 Correct 97 ms 12832 KB Output is correct
30 Correct 89 ms 12268 KB Output is correct
31 Correct 116 ms 13024 KB Output is correct
32 Correct 156 ms 16708 KB Output is correct
33 Correct 90 ms 12948 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 852 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 7200 KB Output is correct
39 Correct 10 ms 7636 KB Output is correct
40 Correct 10 ms 7568 KB Output is correct
41 Correct 114 ms 12428 KB Output is correct
42 Correct 93 ms 13260 KB Output is correct
43 Correct 160 ms 16856 KB Output is correct
44 Correct 87 ms 12584 KB Output is correct
45 Runtime error 1 ms 300 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -