Submission #1136460

#TimeUsernameProblemLanguageResultExecution timeMemory
1136460PlayVoltzVlak (COCI20_vlak)C++20
70 / 70
15 ms19012 KiB
#include <cstdio> #include <stdio.h> #include <stdbool.h> #include <iostream> #include <map> #include <vector> #include <climits> #include <stack> #include <string> #include <queue> #include <algorithm> #include <set> #include <unordered_set> #include <unordered_map> #include <cmath> #include <cctype> #include <bitset> #include <iomanip> #include <cstring> #include <numeric> #include <cassert> using namespace std; #define int long long #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second int counter=0, trie[1000005][26]; bool got[1000005][2]; void insert(string s, bool who){ int node=0; for (auto c:s){ if (!trie[node][c-'a'])trie[node][c-'a']=++counter; node=trie[node][c-'a']; got[node][who]=1; } } bool dfs(int node, bool who){ bool win=0; for (int i=0; i<26; ++i)if (got[trie[node][i]][who])win|=!dfs(trie[node][i], !who); return win; } int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; string s; cin>>n; while (n--)cin>>s, insert(s, 0); cin>>n; while (n--)cin>>s, insert(s, 1); cout<<(dfs(0, 0)?"Nina":"Emilija"); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...