Submission #1014126

#TimeUsernameProblemLanguageResultExecution timeMemory
1014126vjudge1Vlak (COCI20_vlak)C++17
70 / 70
9 ms12124 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair <int, int> using namespace std; const int siz = 28; const int N = 2e6 + 10; const int M = 2e5 + 10; struct node { int ch[siz]; int vis[2], sum[2]; } trie[N]; char c[M]; bool fg[N]; int rt = 0, ncnt = 0; inline void insert(char *s, int who) { int p = rt; for (int i = 0; s[i]; ++i) { int j = s[i] - 'a'; if (!trie[p].ch[j]) trie[p].ch[j] = ++ncnt; p = trie[p].ch[j]; trie[p].sum[who] ++; } trie[p].vis[who] ++; } inline void solve(int p, int who) { for (int i = 0; i < siz; ++i) { if (trie[p].ch[i]) { solve(trie[p].ch[i], who ^ 1); if (trie[trie[p].ch[i]].sum[who] > 0) { if (!fg[trie[p].ch[i]]) { fg[p] = true; return ; } } } } fg[p] = false; } int main() { int n, m; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%s", c); insert(c, 0); } scanf("%d", &m); for (int i = 1; i <= m; ++i) { scanf("%s", c); insert(c, 1); } solve(0, 0); if (fg[0]) printf("Nina"); else printf("Emilija"); //11 11 11 11 11 11 Yeah return 0; }

Compilation message (stderr)

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