Submission #753213

#TimeUsernameProblemLanguageResultExecution timeMemory
753213MilosMilutinovicVlak (COCI20_vlak)C++14
70 / 70
15 ms9936 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int M = 20 * N; const int A = 26; int n, m, tsz, ch[M][A]; bool has[M][2]; char str[N]; void ins(int x) { int nd = 0; for (int i = 1; i <= strlen(str + 1); i++) { int c = (int) (str[i] - 'a'); if (!ch[nd][c]) ch[nd][c] = ++tsz; nd = ch[nd][c]; has[nd][x] = true; } } bool solve(int nd, int player) { bool win = false; for (int i = 0; i < A; i++) { if (!ch[nd][i]) continue; if (has[ch[nd][i]][player]) { win = (win | !solve(ch[nd][i], player ^ 1)); } } return win; } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s", str + 1); ins(0); } scanf("%d", &m); for (int i = 1; i <= m; i++) { scanf("%s", str + 1); ins(1); } if (solve(0, 0)) printf("Nina\n"); else printf("Emilija\n"); return 0; } /* 2 aaa bbb 3 aab aba bbb */

Compilation message (stderr)

Main.cpp: In function 'void ins(int)':
Main.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 1; i <= strlen(str + 1); i++) {
      |                     ~~^~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         scanf("%s", str + 1);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:36:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     scanf("%d", &m);
      |     ~~~~~^~~~~~~~~~
Main.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         scanf("%s", str + 1);
      |         ~~~~~^~~~~~~~~~~~~~~
#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...