Submission #636573

#TimeUsernameProblemLanguageResultExecution timeMemory
636573rainboyJail (JOI22_jail)C11
5 / 100
53 ms3528 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...