| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 844760 | vjudge1 | Vlak (COCI20_vlak) | C++17 | 17 ms | 22428 KiB |
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 <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll MAXN = 5005;
struct Node {
Node *to[26];
};
bool dfs(Node *nodeF, Node *nodeS, int turn) {
if (turn == 0) {
for (int i = 0; i < 26; i++) {
if (nodeF->to[i] != NULL && nodeS->to[i] == NULL)
return true;
}
for (int i = 0; i < 26; i++) {
if (nodeF->to[i] != NULL) {
bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn);
if (!Q)
return true;
}
}
return false;
} else {
for (int i = 0; i < 26; i++) {
if (nodeS->to[i] != NULL && nodeF->to[i] == NULL)
return true;
}
for (int i = 0; i < 26; i++) {
if (nodeS->to[i] != NULL) {
bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn);
if (!Q)
return true;
}
}
return false;
}
}
int main() {
fast
int n;
cin >> n;
Node *root1 = new Node();
Node *root2 = new Node();
for (int i = 0; i < n; i++) {
string s;
cin >> s;
Node *now = root1;
for (int j = 0; j < s.length(); j++) {
int t = s[j] - 'a';
if (now->to[t] == NULL)
now->to[t] = new Node();
now = now->to[t];
}
}
int m;
cin >> m;
for (int i = 0; i < m; i++) {
string s;
cin >> s;
Node *now = root2;
for (int j = 0; j < s.length(); j++) {
int t = s[j] - 'a';
if (now->to[t] == NULL)
now->to[t] = new Node();
now = now->to[t];
}
}
if (dfs(root1, root2, 0))
cout << "Nina\n";
else
cout << "Emilija\n";
}
Compilation message (stderr)
| # | 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... | ||||
