Submission #961965

#TimeUsernameProblemLanguageResultExecution timeMemory
961965rnazymxanVlak (COCI20_vlak)C++17
0 / 70
1061 ms600 KiB
#include<iostream> #include<unordered_map> #include<vector> using namespace std; #define ll long long void init_code(){ #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const int N = 1e5 + 11; struct Node { Node* node[26]; Node(){ for(int i = 0; i < 26; i++){ node[i] = NULL; } } }; void add(Node* root, string s){ int ptr = 0; int n = s.size(); while(ptr < n){ if(root->node[s[ptr] - 'a'] != NULL){ root = root->node[s[ptr] - 'a']; }else{ root->node[s[ptr] - 'a'] = new Node(); root = root->node[s[ptr] - 'a']; } ptr++; } } bool win(Node* trie1, Node* trie2){ for(int i = 0; i < 26; i++){ if(trie1->node[i] != NULL && trie2->node[i] == NULL){ return true; } } bool hehe = false; for(int i = 0; i < 26; i++){ if(trie1->node[i] != NULL){ hehe |= !win(trie2 -> node[i], trie1 -> node[i]); } } return hehe; } int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // init_code(); freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); int n; string s; cin >> n; Node *trie1 = new Node(); Node *trie2 = new Node(); while(n--){ cin >> s; add(trie1, s); } cin >> n; while(n--){ cin >> s; add(trie2, s); } if(win(trie1, trie2)){ cout << "Nina"; }else{ cout << "Emilija"; } }

Compilation message (stderr)

Main.cpp: In function 'void init_code()':
Main.cpp:10:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   freopen("input.txt", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   freopen("output.txt", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:65:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   65 |   freopen("input.in", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:66:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |         freopen("input.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#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...