Submission #1288005

#TimeUsernameProblemLanguageResultExecution timeMemory
1288005Richard_DyinmanVlak (COCI20_vlak)C++20
70 / 70
17 ms20280 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long //#pragma GCC optimize("O3,unroll-loops") //#define int ll #define ld long double #define all(x) x.begin(), x.end() //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; //template <class T> //using ordered_set = // tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define file \ freopen("yinyang.in", "r", stdin);\ freopen("yinyang.out", "w", stdout) #define OJudge(in,out) \ (void)freopen(in, "r", stdin);\ (void)freopen(out, "w", stdout) #define FIn \ cin.tie(0); \ cout.tie(0); \ ios_base::sync_with_stdio(false) #define rep(i, a, b) for(int i = a; i < (b); ++i) //#define sz(x) (int)(x).size() typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; const string IN = "input.txt"; const string OUT = "output.txt"; int tc; ll n , m ,w, c , a, q, b,d; struct Trie{ struct Node { Node *ch[26]; bool frst , sec; Node() { frst = sec = 0; memset(ch, 0, sizeof ch); } }; Node *root = new Node(); void insert(const string &s, bool f) { Node *curr = root; for (char x: s) { ll pos = x - 'a'; if (curr->ch[pos] == 0)curr->ch[pos] = new Node(); curr = curr->ch[pos]; f ? curr->frst = 1 : curr->sec = 1; } } bool ans(Node *cur, int nw){ if(nw%2){ if(!cur->sec) return 1; bool t = 1; for(auto s : cur->ch){ if(!s) continue; if(s->sec){ t &= ans(s , nw + 1); } } return t; }else{ if(!cur->frst) return 0; bool t = 0; for(auto s : cur->ch){ if(!s) continue; if(s->frst) t |= ans(s , nw + 1); } return t; } } bool ans(){ bool t = 0; for(auto s : root->ch) { if(s == 0) continue; t |= ans(s, 1); } return t; } }; void solve() { cin>>n; string str; Trie tr; for(int i = 0; i < n; i++){ cin>>str; tr.insert(str , 1); } cin>>n; for(int i = 0; i < n; i++){ cin>>str; tr.insert(str , 0); } cout<<(tr.ans()?"Nina": "Emilija"); } signed main() { FIn; // file; // #ifndef ONLINE_JUDGE // OJudge(IN.c_str(),OUT.c_str()); // #endif bool test = 0; if (test) cin>>tc; else tc = 1; for (int i = 1; i<=tc; i++){ // cout<<"Case #"<<i<<": "; solve(); } }
#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...