Submission #708023

#TimeUsernameProblemLanguageResultExecution timeMemory
708023assem_albitarVlak (COCI20_vlak)C++14
70 / 70
27 ms22720 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define mod 1000000007 #define mxe(v) *max_element(v.begin(), v.end()) #define all(v) v.begin(), v.end() #define allr(v) v.rbegin(),v.rend() #define F first #define S second #define pi pair<ll,ll> #define assem ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; using namespace std; const int N=400200; const double PI=3.1415926535897932384626433; const double eps = 1e-9; string getString() { char c[(int)2e6]; //scanf(" %c",&a[i]); scanf("%s", c); return c; //string x = getString(); } ///printf("%d\n",); ///scanf("%d",&); ///cout.precision(10); ///puts("")string int n,m; vector<string> v; struct trie { trie* child[26]; trie() { memset(child,0,sizeof child); } void add(int i,int j) { if(j==v[i].size())return; int to=v[i][j]-'a'; if(child[to]==0)child[to]=new trie(); child[to]->add(i,j+1); } }; bool dp(trie* a1,trie* a2,bool g) { bool f=0; if(g) { for(char i='a'; i<='z'; i++) { if(a1->child[i-'a']!=0&&a2->child[i-'a']==0) { f=1; } else if(a1->child[i-'a']!=0&&a2->child[i-'a']!=0) { f=f||!(dp(a1->child[i-'a'],a2->child[i-'a'],!g)); } } } else { for(char i='a'; i<='z'; i++) { if(a2->child[i-'a']!=0&&a1->child[i-'a']==0) { f=1; } else if(a2->child[i-'a']!=0&&a1->child[i-'a']!=0) { f=f||!(dp(a1->child[i-'a'],a2->child[i-'a'],!g)); } } } return f; } int main() { cin>>n; trie* root1=new trie(); for(int i=0; i<n; i++) { string q; cin>>q; v.push_back(q); root1->add(i,0); } v.clear(); trie* root2=new trie(); cin>>m; for(int i=0; i<m; i++) { string q; cin>>q; v.push_back(q); root2->add(i,0); } if(dp(root1,root2,1)) { cout<<"Nina"<<endl; } else { cout<<"Emilija"<<endl; } }

Compilation message (stderr)

Main.cpp: In member function 'void trie::add(int, int)':
Main.cpp:41:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if(j==v[i].size())return;
      |            ~^~~~~~~~~~~~~
Main.cpp: In function 'std::string getString()':
Main.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     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...