#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//typedef __int128 lll;
#define PI 3.14159265358979323846
#define sbits(x) __builtin_popcountll(x)
#define tbits(total_size, num) ((total_size) - __builtin_clz(num))
#define pb push_back
#define f first
#define s second
#define clr(ds) ds.clear()
#define all(ds) ds.begin(), ds.end()
#define pi pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pi>
#define sz(i) (int)i.size()
using namespace std;
int xP[] = {0,0,1,-1,1,1,-1,-1} , yP[] = {1,-1,0,0,1,-1,-1,1};
uint64_t time() {
using namespace std::chrono;
return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
}
int rand(int a , int b){
return a + rand()%(b-a+1);
}
void setIO(string name = "") {
cin.tie(0)->sync_with_stdio(0);
if (name.size()) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
bool ckmin(auto& a , auto b){if(a<=b)return 0; else {a=b;return 1;}}
bool ckmax(auto& a , auto b){if(a>=b)return 0; else {a=b;return 1;}}
/*
_______________________________________
( If you don't fail at least 90% of the )
( time, you're not aiming high enough. )
( )
( - Alan Kay )
---------------------------------------
o ^__^
o (oo)\_______
(__)\ )\/\
||----w |
|| ||
*/
const int MAXN = 2e5+1;
struct trie{
int tree[MAXN][26];
int p;
trie(){p = 1;}
void add(string& temp){
int curr = 0;
for(int i = 0;i<sz(temp);i++){
if(tree[curr][temp[i]-97])
curr = tree[curr][temp[i]-97];
else
curr = tree[curr][temp[i]-97] = p++;
}
}
};
int dfs(trie& a , trie& b , int pA , int pB , bool turn){
for(int i =0;i<26;i++){
// a has a character b doesnt
if(turn == 0 && a.tree[pA][i]){
if(!b.tree[pB][i])
return turn;
if(dfs(a , b , a.tree[pA][i], b.tree[pB][i] , 1)==0)
return 0;
} else if(turn && b.tree[pB][i]){
if(!a.tree[pA][i])
return turn;
if(dfs(a , b , a.tree[pA][i] , b.tree[pB][i] , 0))
return 1;
}
}
return 1^turn;
}
int n, m;
void solve(){
trie a , b;
cin >> n;
for(int i= 0;i<n;i++){
string temp;
cin >> temp;
a.add(temp);
}
cin >> m;
for(int i = 0;i<m;i++){
string temp;
cin >> temp;
b.add(temp);
}
cout << (dfs(a , b , 0 , 0 , 0)?"Emilijia":"Nina") << "\n";
}
int main(){
setIO();
int t = 1;
// cin >> t;
while(t--){
solve();
}
}
Compilation message
Main.cpp:35:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
35 | bool ckmin(auto& a , auto b){if(a<=b)return 0; else {a=b;return 1;}}
| ^~~~
Main.cpp:35:22: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
35 | bool ckmin(auto& a , auto b){if(a<=b)return 0; else {a=b;return 1;}}
| ^~~~
Main.cpp:36:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
36 | bool ckmax(auto& a , auto b){if(a>=b)return 0; else {a=b;return 1;}}
| ^~~~
Main.cpp:36:22: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
36 | bool ckmax(auto& a , auto b){if(a>=b)return 0; else {a=b;return 1;}}
| ^~~~
Main.cpp: In function 'void setIO(std::string)':
Main.cpp:31:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | freopen((name + ".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:32:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
32 | freopen((name + ".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
35 ms |
41172 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
41044 KB |
Output is correct |
2 |
Correct |
31 ms |
41088 KB |
Output is correct |
3 |
Correct |
31 ms |
41060 KB |
Output is correct |
4 |
Incorrect |
31 ms |
41144 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
41044 KB |
Output is correct |
2 |
Correct |
31 ms |
41044 KB |
Output is correct |
3 |
Incorrect |
31 ms |
41020 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
41036 KB |
Output is correct |
2 |
Correct |
32 ms |
41036 KB |
Output is correct |
3 |
Correct |
31 ms |
41044 KB |
Output is correct |
4 |
Incorrect |
31 ms |
41048 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
41300 KB |
Output is correct |
2 |
Incorrect |
33 ms |
41292 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
41264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
41132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |