Submission #1011701

#TimeUsernameProblemLanguageResultExecution timeMemory
1011701vjudge1Vlak (COCI20_vlak)C++17
70 / 70
14 ms9820 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int const N=2e5+5; int const mod=1e9+7; int nxt[N][26]; bool st1[N],st2[N]; bool is_pre[N][2],win[N][2]; int cnt=1; void dfs(int node){ for (int i = 0; i < 26; ++i) { if(nxt[node][i]==0) continue; int nt=nxt[node][i]; dfs(nt); win[node][0] |= is_pre[nt][0] && (!win[nt][1]); win[node][1] |= is_pre[nt][1] && (!win[nt][0]); } } int main(){ for (int p = 0; p < 2; ++p) { int n; cin>>n; for (int i = 0; i < n; ++i) { string a; cin>>a; int cur=0; for(char c:a){ if(nxt[cur][c-'a']==0) nxt[cur][c-'a']=cnt++; is_pre[cur][p]=1; cur=nxt[cur][c-'a']; } is_pre[cur][p]=1; } } 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...