Submission #636573

# Submission time Handle Problem Language Result Execution time Memory
636573 2022-08-29T15:15:04 Z rainboy Jail (JOI22_jail) C
5 / 100
53 ms 3528 KB
#include <stdio.h>
#include <string.h>

#define N	120000

int main() {
	int t;

	scanf("%d", &t);
	while (t--) {
		static int jj[N];
		int n, m, h, i, j, yes;

		scanf("%d", &n);
		for (h = 0; h < n - 1; h++)
			scanf("%d%d", &i, &j), i--, j--;
		scanf("%d", &m);
		memset(jj, -1, n * sizeof *jj);
		while (m--) {
			scanf("%d%d", &i, &j), i--, j--;
			jj[i] = j;
		}
		yes = 1;
		for (i = 0, j = -1; i < n; i++)
			if (jj[i] != -1) {
				if (j >= jj[i]) {
					yes = 0;
					break;
				}
				j = jj[i];
			}
		printf(yes ? "Yes\n" : "No\n");
	}
	return 0;
}

Compilation message

jail.c: In function 'main':
jail.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &t);
      |  ^~~~~~~~~~~~~~~
jail.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
jail.c:16:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |    scanf("%d%d", &i, &j), i--, j--;
      |    ^~~~~~~~~~~~~~~~~~~~~
jail.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", &m);
      |   ^~~~~~~~~~~~~~~
jail.c:20:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |    scanf("%d%d", &i, &j), i--, j--;
      |    ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 11 ms 556 KB Output is correct
5 Correct 23 ms 912 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 25 ms 1440 KB Output is correct
10 Correct 26 ms 2124 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 30 ms 1236 KB Output is correct
13 Correct 39 ms 2320 KB Output is correct
14 Correct 36 ms 2632 KB Output is correct
15 Correct 35 ms 2692 KB Output is correct
16 Correct 50 ms 3464 KB Output is correct
17 Correct 38 ms 2816 KB Output is correct
18 Correct 53 ms 3528 KB Output is correct
19 Correct 38 ms 2816 KB Output is correct
20 Correct 39 ms 2892 KB Output is correct
21 Correct 36 ms 2852 KB Output is correct
22 Correct 38 ms 2820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 6 ms 420 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 11 ms 556 KB Output is correct
5 Correct 23 ms 912 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 25 ms 1440 KB Output is correct
10 Correct 26 ms 2124 KB Output is correct
11 Correct 5 ms 340 KB Output is correct
12 Correct 30 ms 1236 KB Output is correct
13 Correct 39 ms 2320 KB Output is correct
14 Correct 36 ms 2632 KB Output is correct
15 Correct 35 ms 2692 KB Output is correct
16 Correct 50 ms 3464 KB Output is correct
17 Correct 38 ms 2816 KB Output is correct
18 Correct 53 ms 3528 KB Output is correct
19 Correct 38 ms 2816 KB Output is correct
20 Correct 39 ms 2892 KB Output is correct
21 Correct 36 ms 2852 KB Output is correct
22 Correct 38 ms 2820 KB Output is correct
23 Correct 0 ms 288 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Incorrect 1 ms 212 KB Output isn't correct
27 Halted 0 ms 0 KB -