#include <bits/stdc++.h>
// #define int long long
#define ll long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
const int MAXN = 6e5+10;
const int MAXA = 2e5;
const int INF = 1e9+100;
const int SQRT = 500;
const int LOG = 26;
const int MOD = 1e9;
void chmn(auto &a, auto b){ a = min(a, b); }
void chmx(int &a, int b){ a = max(a, b); }
int n,m;
string x;
struct node {
node* chi[26];
int cnt;
void UPD(int siz){
cnt++;
if(x.size() == siz) return;
int id = x[siz]-'a';
if(chi[id] == NULL) chi[id] = new node();
chi[id]->UPD(siz+1);
}
} *A, *B;
bool sol(node *x, node *y){ // x harus bikin move
bool can = 0;
for(int i=0; i<26; i++){
if(x->chi[i]==NULL) continue; // gk punya chi samsek
//x lanjut
if(y->chi[i]==NULL) return 1; // y gbs
can |= 1-sol(y->chi[i], x->chi[i]);
}
// cout << x->cnt << ' ' << can << " can\n";
return can;
}
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
A = new node(); B = new node();
for(int i=1; i<=n; i++){
cin>>x; A->UPD(0);
}
cin>>m;
for(int i=1; i<=m; i++){
cin>>x; B->UPD(0);
}
cout << (sol(A,B) ? "Nina\n" : "Emilija\n");
}
# | 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... |