Submission #844759

#TimeUsernameProblemLanguageResultExecution timeMemory
844759vjudge1Vlak (COCI20_vlak)C++17
70 / 70
15 ms22616 KiB
#include <bits/stdc++.h> #pragma optimize "DostSeferoğlu" #pragma GCC optimize("unroll-loops,Ofast") #pragma GCC target("avx2,tune=native") using namespace std; #define int long long #define pii pair<int,int> #define bg begin #define vi vector<int> #define endl '\n' #define vvi vector<vi> #define vp vector<pii> #define sp << " " << #define all(x) x.bg()+1,x.end() #define ff first #define ss second #define brake {cout << "OK\n";return;} #define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;} #define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx) #define F(xx,yy) for (int xx=1;xx<=yy;++xx) #define pb push_back const int inf = 1e18; const int MOD = 998244353; const int N = 2e5+1; struct Node { Node* children[26]; Node() { for (int i = 0; i < 26; ++i) children[i] = NULL; } }; void add(Node* root,string s) { int ptr = 0; int n = s.size(); while (ptr < n) { if (root->children[s[ptr]-'a'] != NULL) { root = root->children[s[ptr]-'a']; } else { root->children[s[ptr]-'a'] = new Node(); root = root->children[s[ptr]-'a']; } ptr++; } } bool win(Node* trie1,Node*trie2) { for (int i=0;i<26;i++){ if (trie1->children[i] != NULL && trie2->children[i]==NULL) { return true; } } bool wins = false; for (int i=0;i<26;i++) { if (trie1->children[i] != NULL) { wins = max(wins,!win(trie2->children[i],trie1->children[i])); } } return wins; } void solve() { int n; cin >> n; Node *trie1 = new Node(); Node *trie2 = new Node(); for (int i=1;i<=n;i++) { string s; cin >> s; add(trie1,s); } int m; cin >> m; for (int i=1;i<=m;i++) { string s; cin >> s; add(trie2,s); } if (win(trie1,trie2)) { cout << "Nina\n"; } else cout << "Emilija\n"; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0); #ifdef Local freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }

Compilation message (stderr)

Main.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize "DostSeferoğlu"
      |
#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...