#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define eb emplace_back
#define ll long long
#define fi first
#define se second
int t,n,i;
const int maxn = 3e5 + 10;
string s;
struct trie
{
int co = 0;
struct nodes
{
int child[26] = {};
}node[maxn];
void add(string s)
{
int pos = 0;
for(char ch : s)
{
if(node[pos].child[ch - 'a'] == 0)node[pos].child[ch - 'a'] = ++co;
pos = node[pos].child[ch - 'a'];
}
}
}a,b;
bool cal(int i,int j,bool ch)
{
for(int k = 0;k<26;k++)
{
if(ch)
{
if(!a.node[i].child[k] && b.node[j].child[k])return ch;
}
else
{
if(a.node[i].child[k] && !b.node[j].child[k])return ch;
}
if(a.node[i].child[k] && b.node[j].child[k] && cal(a.node[i].child[k],b.node[j].child[k],!ch) == ch)return ch;
}
return !ch;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n;
while(n--)
{
cin>>s;
a.add(s);
}
cin>>n;
while(n--)
{
cin>>s;
b.add(s);
}
cout<<(cal(0,0,0) ? "Emilija" : "Nina");
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |