This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define fast_io ios::sync_with_stdio(0), cin.tie(0)
#define vi vector<int>
const int N = 2e5+7, K = 26;
int adj[2][N][K], ctr[2];
void add(string& s, int d) {
int x = 0;
for(char ch: s) {
int c = ch-'a', y = adj[d][x][c];
if(!y) adj[d][x][c] = ++ctr[d];
x = adj[d][x][c];
}
}
int dfs(int x, int d) {
int wx = 0;
for(int y: adj[d][x]) {
if(!y) continue;
wx |= dfs(y, d^1)^1;
}
return wx;
}
int main() {
fast_io;
int n; string s;
for(int k = 0; k < 2; k++) {
cin >> n;
for(int i = 0; i < n; i++) {
cin >> s;
add(s, k);
}
}
int ret = dfs(0, 0);
cout << (ret? "Nina": "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... |