Submission #425228

#TimeUsernameProblemLanguageResultExecution timeMemory
425228keta_tsimakuridzeVlak (COCI20_vlak)C++14
70 / 70
36 ms19224 KiB
#include<bits/stdc++.h> using namespace std; const int N=2e5+5; int aft[N][30],fix[N][2],cur,n,m; vector<int>V[N]; string s; void add(string s,int f){ int u = 0; for(int i=0;i<s.size();i++){ if(!aft[u][s[i]-'0']) { cur++; aft[u][s[i]-'0'] = cur; V[u].push_back(aft[u][s[i]-'0']); } u = aft[u][s[i]-'0']; fix[u][f] = 1; } } bool dfs(int u,int f) { int o = 0; //cout<< f << " "<< u << endl; if(!fix[u][f]) return 0; if(!fix[u][1-f]) return 1; for(int i=0;i<V[u].size();i++){ bool x = dfs(V[u][i],1^f); o|=x; // cout<<u<<" "<<f<<" "<<x<<endl; } return o^1; } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>s; add(s,0); } cout<<endl; cin>>m; for(int i=1;i<=m;i++){ cin>>s; add(s,1); } int x = 0; for(int i=0;i<V[0].size();i++) x|=dfs(V[0][i],0); if(x) cout<<"Nina"; else cout<<"Emilija"; }

Compilation message (stderr)

Main.cpp: In function 'void add(std::string, int)':
Main.cpp:9:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int i=0;i<s.size();i++){
      |              ~^~~~~~~~~
Main.cpp: In function 'bool dfs(int, int)':
Main.cpp:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for(int i=0;i<V[u].size();i++){
      |               ~^~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:44:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for(int i=0;i<V[0].size();i++) x|=dfs(V[0][i],0);
      |              ~^~~~~~~~~~~~
#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...