Submission #595710

#TimeUsernameProblemLanguageResultExecution timeMemory
595710tht2005Vlak (COCI20_vlak)C++17
70 / 70
12 ms9812 KiB
#include <bits/stdc++.h> using namespace std; int rd() { bool neg = 0; char c = getchar(); for(; c < '0' || c > '9'; c = getchar()) if(c == '-') neg = !neg; int n = 0; while('0' <= c && c <= '9') n = (n << 3) + (n << 1) + c - '0', c = getchar(); return neg ? -n : n; } void wr(int n) { static char o[11]; if(n < 0) putchar('-'), n = -n; int i = 0; do o[i++] = n % 10 + '0'; while(n /= 10); while(i--) putchar(o[i]); } #define L 200005 #define V ((N) * (L)) int cnt = 1, nxt[L][26]; bool lf[2][L]; char s[L]; bool f(int v, int t) { for(int i = 26, u; i--; ) { u = nxt[v][i]; if(u == 0 || !lf[t][u]) { continue; } if(!f(u, t ^ 1)) { return 1; } } return 0; } int main() { for(int t = 0; t < 2; ++t) { int n; scanf("%d", &n); for(int i = 0, l, p; i < n; ++i) { scanf("%s", s); l = strlen(s); p = 0; for(int j = 0, e; j < l; ++j) { e = s[j] - 'a'; if(nxt[p][e] == 0) { nxt[p][e] = cnt++; } p = nxt[p][e]; lf[t][p] = 1; } } } puts(f(0, 0) ? "Nina" : "Emilija"); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
Main.cpp:42:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |             scanf("%s", s);
      |             ~~~~~^~~~~~~~~
#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...