답안 #483287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
483287 2021-10-28T13:27:29 Z rainboy Vlak (COCI20_vlak) C
70 / 70
10 ms 9804 KB
#include <stdio.h>
#include <string.h>

#define N_	200002
#define A	26

int tt[N_][A]; char msk[N_];

int dfs(int i, int t) {
	int a;

	for (a = 0; a < A; a++) {
		int j = tt[i][a];

		if ((msk[j] & 1 << t) != 0 && !dfs(j, t ^ 1))
			return 1;
	}
	return 0;
}

int main() {
	int n, n_;

	scanf("%d", &n);
	n_ = 2;
	while (n--) {
		static char cc[N_];
		int l, h, i;

		scanf("%s", cc), l = strlen(cc);
		for (h = 0, i = 1; h < l; h++) {
			int a = cc[h] - 'a';

			if (!tt[i][a])
				tt[i][a] = n_++;
			i = tt[i][a];
			msk[i] |= 1;
		}
	}
	scanf("%d", &n);
	while (n--) {
		static char cc[N_];
		int l, h, i;

		scanf("%s", cc), l = strlen(cc);
		for (h = 0, i = 1; h < l; h++) {
			int a = cc[h] - 'a';

			if (!tt[i][a])
				tt[i][a] = n_++;
			i = tt[i][a];
			msk[i] |= 2;
		}
	}
	printf(dfs(1, 0) ? "Nina\n" : "Emilija\n");
	return 0;
}

Compilation message

Main.c: In function 'main':
Main.c:24:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:30:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |   scanf("%s", cc), l = strlen(cc);
      |   ^~~~~~~~~~~~~~~
Main.c:40:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:45:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   scanf("%s", cc), l = strlen(cc);
      |   ^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 412 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9164 KB Output is correct
2 Correct 8 ms 8652 KB Output is correct
3 Correct 8 ms 8104 KB Output is correct
4 Correct 8 ms 8908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 9436 KB Output is correct
2 Correct 8 ms 9804 KB Output is correct
3 Correct 8 ms 9036 KB Output is correct
4 Correct 8 ms 9164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8848 KB Output is correct
2 Correct 8 ms 8652 KB Output is correct
3 Correct 8 ms 8944 KB Output is correct
4 Correct 8 ms 9420 KB Output is correct