Submission #1121206

#TimeUsernameProblemLanguageResultExecution timeMemory
1121206hahahoang132Vlak (COCI20_vlak)C++17
70 / 70
27 ms24656 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll N = 1e7; const ll base = 10007; const ll inf = LLONG_MAX/4; const ll mod = 1e9 + 7; #define bit(x,y) ((x >> y) & 1) struct node { node* c[30]; ll haha[2]; node() { haha[0] = haha[1] = 0; for(ll i = 0;i < 26;i++) c[i] = NULL; } }; struct trie { node r; void add(string s, ll t) { ll i = 0; node *cur = &r; while(i < s.size()) { ll k = s[i] - 'a'; if(!cur->c[k]) { cur->c[k] = new node(); } cur = cur->c[k]; cur->haha[t] = 1; i++; } } ll cal(node *cur, ll e) { ll ans = 0; for(ll i = 0;i < 26;i++) { if(cur->c[i] && cur->c[i]->haha[e]) { if(!cal(cur->c[i],1 - e)) ans = 1; } } return ans; } }; trie f; int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n,m; cin >> n; ll i,j; for(i = 1;i <= n;i++) { string s; cin >> s; f.add(s,0); } cin >> m; for(i = 1;i <= m;i++) { string s; cin >> s; f.add(s,1); } if(f.cal(&f.r,0)) cout << "Nina"; else cout << "Emilija"; }

Compilation message (stderr)

Main.cpp: In member function 'void trie::add(std::string, ll)':
Main.cpp:28:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         while(i < s.size())
      |               ~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:60:10: warning: unused variable 'j' [-Wunused-variable]
   60 |     ll i,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...