Submission #1006562

#TimeUsernameProblemLanguageResultExecution timeMemory
1006562vjudge1Vlak (COCI20_vlak)C++17
70 / 70
21 ms20496 KiB
#include<bits/stdc++.h> using namespace std; string ans[] = {"Emilija", "Nina"}; struct node { node *ch[26]; bool f, s; bool fw, sw; node() { f = fw = s = sw = false; for(int i = 0; i < 26; i++) ch[i] = NULL; } void insert(string &t, bool fir, int i = 0) { f |= fir; s |= (!fir); if(i == t.size()) return; int c = t[i] - 'a'; if(ch[c] == NULL) ch[c] = new node(); ch[c] -> insert(t, fir, i + 1); } void compute() { bool leaf = true; for(int i = 0; i < 26; i ++) if(ch[i] != NULL) { leaf = false; ch[i] -> compute(); fw |= !ch[i]->sw; sw |= !ch[i]->fw; } if(!f) fw = false; if(!s) sw = false; if(leaf) fw = sw = false; } }; node *root = new node(); int main() { int n; cin >> n; for(int i = 0; i < n; i ++) { string s; cin >> s; root -> insert(s, true); } cin >> n; for(int i = 0; i < n; i ++) { string s; cin >> s; root -> insert(s, false); } root -> compute(); cout << ans[root -> fw] << endl; return 0; }

Compilation message (stderr)

Main.cpp: In member function 'void node::insert(std::string&, bool, int)':
Main.cpp:23:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if(i == t.size()) return;
      |        ~~^~~~~~~~~~~
#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...