Submission #570404

#TimeUsernameProblemLanguageResultExecution timeMemory
570404a_aguiloVlak (COCI20_vlak)C++14
70 / 70
30 ms27364 KiB
#include<bits/stdc++.h> using namespace std; struct nodo{ char letra; vector<nodo*> ady; nodo(char c){ letra = c; ady.assign(26, NULL); } }; void construct(int pos, string& S, nodo* prev){ if(pos == S.size()) return; char c = S[pos]; int n_letra = c-'a'; if (prev->ady[n_letra] != NULL){ construct(pos+1, S, prev->ady[n_letra]); } else{ nodo* act = new nodo(c); prev->ady[n_letra] = act; construct(pos+1, S, act); } } bool win(nodo* Nina, nodo* Emilija, int state){ // 1 = nina; // 0 = emilija; if(state){ for(int i = 0; i < 26; ++i){ if(Nina->ady[i] != NULL){ if(Emilija->ady[i] == NULL) return true; if(!win(Nina->ady[i], Emilija->ady[i], 0)) return true; } } return false; } else{ for(int i = 0; i < 26; ++i){ if(Emilija->ady[i] != NULL){ if(Nina->ady[i] == NULL) return true; if(!win(Nina->ady[i], Emilija->ady[i], 1)) return true; } } return false; } } int main(){ int n, m; string S; nodo inicioNina = nodo('.'); nodo inicioEmilija = nodo('.'); cin >> n; for(int i = 0; i < n; ++i){ cin >> S; construct(0, S, &inicioNina); } cin >> m; for(int i = 0; i < m; ++i){ cin >> S; construct (0, S, &inicioEmilija); } if(win(&inicioNina, &inicioEmilija, 1)) cout << "Nina" << endl; else cout << "Emilija" << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'void construct(int, std::string&, nodo*)':
Main.cpp:15:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     if(pos == S.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...