Submission #390500

#TimeUsernameProblemLanguageResultExecution timeMemory
390500ngpin04Vlak (COCI20_vlak)C++14
70 / 70
11 ms10792 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair using namespace std; const int N = 2e5 + 5; int ptr[2][N][26]; int n, node; bool Win[N]; void add(string &s, int id) { int cur = 0; for (char c : s) { int &p = ptr[id][cur][c - 'a']; if (p == 0) p = ++node; cur = p; } } bool solve(int i, int j, int cur) { bool res = false; for (int val = 0; val < 26; val++) { int pcur = ptr[cur][i][val]; if (pcur == 0) continue; int pnxt = ptr[cur ^ 1][j][val]; if (pnxt == 0) return true; res |= !solve(pnxt, pcur, cur ^ 1); } return res; } void proc() { cout << (solve(0, 0, 0) ? ("Nina\n") : ("Emilija\n")); } void enter() { cin >> n; for (int i = 1; i <= n; i++) { string s; cin >> s; add(s, 0); } cin >> n; for (int i = 1; i <= n; i++) { string s; cin >> s; add(s, 1); } } void preproc() { ios_base::sync_with_stdio(0); cin.tie(0); // freopen("KARA.inp","r",stdin); // freopen("KARA.out","w",stdout); } int main() { preproc(); enter(); proc(); 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...