# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1069307 |
2024-08-21T19:09:42 Z |
dflsjkdfsd |
Vlak (COCI20_vlak) |
Python 3 |
|
1000 ms |
228060 KB |
ABC = 28
MAXN = 1000010
class Node:
def __init__(self):
self.state = 0
self.child = [None] * ABC
cnt = 0
nodes = [Node() for _ in range(MAXN * 2)]
def new_node():
global cnt
node = nodes[cnt]
cnt += 1
return node
class Trie:
def __init__(self):
self.root = new_node()
def insert(self, node, s, pos, mask):
if pos == len(s):
return
node.state |= mask
if not node.child[ord(s[pos]) - ord('a')]:
node.child[ord(s[pos]) - ord('a')] = new_node()
self.insert(node.child[ord(s[pos]) - ord('a')], s, pos + 1, mask)
def solve(self, node, turn):
if not (node.state & (1 << turn)):
return 0
for i in range(ABC):
if node.child[i] and not self.solve(node.child[i], turn ^ 1):
return 1
return 0
T = Trie()
ans = ["Emilija", "Nina"]
if __name__ == "__main__":
for i in range(2):
n = int(input())
for _ in range(n):
s = input().strip()
T.insert(T.root, s, 0, (1 << i))
print(ans[T.solve(T.root, 0)])
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1070 ms |
228060 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
227940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
210680 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1032 ms |
223916 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
228060 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1059 ms |
227896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
223904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |