Submission #844760

#TimeUsernameProblemLanguageResultExecution timeMemory
844760vjudge1Vlak (COCI20_vlak)C++17
70 / 70
17 ms22428 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define s second #define f first typedef long long ll; const ll MOD = 998244353; const ll MAXN = 5005; struct Node { Node *to[26]; }; bool dfs(Node *nodeF, Node *nodeS, int turn) { if (turn == 0) { for (int i = 0; i < 26; i++) { if (nodeF->to[i] != NULL && nodeS->to[i] == NULL) return true; } for (int i = 0; i < 26; i++) { if (nodeF->to[i] != NULL) { bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn); if (!Q) return true; } } return false; } else { for (int i = 0; i < 26; i++) { if (nodeS->to[i] != NULL && nodeF->to[i] == NULL) return true; } for (int i = 0; i < 26; i++) { if (nodeS->to[i] != NULL) { bool Q = dfs(nodeF->to[i], nodeS->to[i], 1-turn); if (!Q) return true; } } return false; } } int main() { fast int n; cin >> n; Node *root1 = new Node(); Node *root2 = new Node(); for (int i = 0; i < n; i++) { string s; cin >> s; Node *now = root1; for (int j = 0; j < s.length(); j++) { int t = s[j] - 'a'; if (now->to[t] == NULL) now->to[t] = new Node(); now = now->to[t]; } } int m; cin >> m; for (int i = 0; i < m; i++) { string s; cin >> s; Node *now = root2; for (int j = 0; j < s.length(); j++) { int t = s[j] - 'a'; if (now->to[t] == NULL) now->to[t] = new Node(); now = now->to[t]; } } if (dfs(root1, root2, 0)) cout << "Nina\n"; else cout << "Emilija\n"; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:59:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |   for (int j = 0; j < s.length(); j++) {
      |                   ~~^~~~~~~~~~~~
Main.cpp:74:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |   for (int j = 0; j < s.length(); j++) {
      |                   ~~^~~~~~~~~~~~
#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...