Submission #1011698

#TimeUsernameProblemLanguageResultExecution timeMemory
1011698vjudge1Vlak (COCI20_vlak)C++17
70 / 70
13 ms10076 KiB
#include <bits/stdc++.h> using namespace std; const int M = 2e5 + 1; int nxt[M][26],cnt=1; bool rc[M][2],win[M][2]; void add(string s,int i) { int cur=0; for (char c:s) { if (!nxt[cur][c-'a']) nxt[cur][c-'a']=cnt++; rc[cur][i]=1; cur=nxt[cur][c-'a']; } rc[cur][i]=1; } void dfs(int u) { for (int i=0;i<26;i++) { if (!nxt[u][i]) continue; int v=nxt[u][i]; dfs(v); for (int pl=0;pl<2;pl++) { if (rc[v][pl] && !win[v][1-pl]) win[u][pl]=1; } } } int main() { for (int j=0;j<2;j++) { int n; cin>>n; for (int i=0;i<n;i++) { string s; cin>>s; add(s,j); } } dfs(0); if (win[0][0]) cout<<"Nina"<<endl; else cout<<"Emilija"<<endl; return 0; }
#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...