답안 #1113160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113160 2024-11-16T01:17:23 Z jay22 Vlak (COCI20_vlak) C++14
70 / 70
8 ms 21756 KB
#include <iostream>
#include <cstring>

const int LEN = 200'001;

int N;
int idx, g[LEN][26], t[LEN];
char S[LEN];

int dfs(int k, int l) {
	int ret = 0;
	for (int i = 0; i < 26; ++i) {
		if (~g[k][i] && t[g[k][i]] & 1 << l)
			ret |= !dfs(g[k][i], !l);
	}
	return ret;
}

int main() {
	std::cin.tie(0)->sync_with_stdio(0);
	memset(g, -1, sizeof g);
	for (int b = 1; b <= 2; ++b) {
		std::cin >> N;
		for (int i = 0; i < N; ++i) {
			std::cin >> S;
			for (int j = 0, k = 0, c; S[j]; ++j) {
				c = S[j] - 'a';
				if (!~g[k][c]) g[k][c] = ++idx;
				k = g[k][c];
				t[k] |= b;
			}
		}
	}
	std::cout << (dfs(0, 0) ?  "Nina" : "Emilija");
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 21584 KB Output is correct
2 Correct 4 ms 21584 KB Output is correct
3 Correct 4 ms 21584 KB Output is correct
4 Correct 4 ms 21584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 21584 KB Output is correct
2 Correct 4 ms 21584 KB Output is correct
3 Correct 3 ms 21492 KB Output is correct
4 Correct 3 ms 21584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 21584 KB Output is correct
2 Correct 4 ms 21584 KB Output is correct
3 Correct 4 ms 21756 KB Output is correct
4 Correct 4 ms 21584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 21584 KB Output is correct
2 Correct 3 ms 21584 KB Output is correct
3 Correct 5 ms 21584 KB Output is correct
4 Correct 3 ms 21584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 21584 KB Output is correct
2 Correct 6 ms 21616 KB Output is correct
3 Correct 6 ms 21584 KB Output is correct
4 Correct 8 ms 21728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 21584 KB Output is correct
2 Correct 8 ms 21584 KB Output is correct
3 Correct 6 ms 21584 KB Output is correct
4 Correct 5 ms 21584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 21584 KB Output is correct
2 Correct 6 ms 21584 KB Output is correct
3 Correct 7 ms 21584 KB Output is correct
4 Correct 7 ms 21588 KB Output is correct