# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961966 | 2024-04-12T22:45:20 Z | rnazymxan | Vlak (COCI20_vlak) | C++17 | 16 ms | 22620 KB |
#include<iostream> #include<unordered_map> #include<vector> using namespace std; #define ll long long void init_code(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const int N = 1e5 + 11; struct Node { Node* node[26]; Node(){ for(int i = 0; i < 26; i++){ node[i] = NULL; } } }; void add(Node* root, string s){ int ptr = 0; int n = s.size(); while(ptr < n){ if(root->node[s[ptr] - 'a'] != NULL){ root = root->node[s[ptr] - 'a']; }else{ root->node[s[ptr] - 'a'] = new Node(); root = root->node[s[ptr] - 'a']; } ptr++; } } bool win(Node* trie1, Node* trie2){ for(int i = 0; i < 26; i++){ if(trie1->node[i] != NULL && trie2->node[i] == NULL){ return true; } } bool hehe = false; for(int i = 0; i < 26; i++){ if(trie1->node[i] != NULL){ hehe |= !win(trie2 -> node[i], trie1 -> node[i]); } } return hehe; } int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // init_code(); int n; string s; cin >> n; Node *trie1 = new Node(); Node *trie2 = new Node(); while(n--){ cin >> s; add(trie1, s); } cin >> n; while(n--){ cin >> s; add(trie2, s); } if(win(trie1, trie2)){ cout << "Nina"; }else{ cout << "Emilija"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 856 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
# | 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 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 21084 KB | Output is correct |
2 | Correct | 12 ms | 20176 KB | Output is correct |
3 | Correct | 12 ms | 18892 KB | Output is correct |
4 | Correct | 12 ms | 20568 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 21596 KB | Output is correct |
2 | Correct | 12 ms | 22620 KB | Output is correct |
3 | Correct | 12 ms | 20828 KB | Output is correct |
4 | Correct | 12 ms | 21084 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 20316 KB | Output is correct |
2 | Correct | 14 ms | 20212 KB | Output is correct |
3 | Correct | 14 ms | 20312 KB | Output is correct |
4 | Correct | 15 ms | 21852 KB | Output is correct |