# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938482 | 2024-03-05T07:51:23 Z | asdasdqwer | Vlak (COCI20_vlak) | C++14 | 1000 ms | 19956 KB |
#include <bits/stdc++.h> using namespace std; struct Node { char let; map<char, int> ni; map<char, int> em; bool emTurn=false, niTurn=false; }; vector<Node> trie; void ins(string &s, bool isEm = false) { int idx=0; for (auto &x:s) { if (isEm) { if (trie[idx].em.find(x) == trie[idx].em.end()) { if (trie[idx].ni.find(x) == trie[idx].ni.end()) { Node n1; n1.let = x; trie.push_back(n1); trie[idx].em[x] = (int)trie.size() - 1; } else { trie[idx].em[x] = trie[idx].ni[x]; } } idx = trie[idx].em[x]; } else { if (trie[idx].ni.find(x) == trie[idx].ni.end()) { if (trie[idx].em.find(x) == trie[idx].em.end()) { Node n1; n1.let = x; trie.push_back(n1); trie[idx].ni[x] = (int)trie.size() - 1; } else { trie[idx].ni[x] = trie[idx].em[x]; } } idx = trie[idx].ni[x]; } } } void dfs(int idx) { for (auto [c, i]:trie[idx].ni) { dfs(i); if (!trie[i].emTurn) { trie[idx].niTurn = true; } } for (auto [c, i]:trie[idx].em) { dfs(i); if (!trie[i].niTurn) { trie[idx].emTurn = true; } } } signed main() { int n;cin>>n; Node n1; trie.push_back(n1); for (int i=0;i<n;i++) { string s;cin>>s; ins(s); } int m;cin>>m; for (int i=0;i<m;i++) { string s;cin>>s; ins(s, true); } dfs(0); if (trie[0].niTurn) { cout<<"Nina\n"; } else { cout<<"Emilja\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1051 ms | 604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1033 ms | 604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Incorrect | 1 ms | 600 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 652 KB | Output is correct |
2 | Correct | 2 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Incorrect | 3 ms | 604 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1030 ms | 19956 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1018 ms | 19700 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1008 ms | 18924 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |